r - ggplot2 annotate text with a plot symbol -


i legend ggplot2 plot. legend should identify plotting symbol data. example, data1 plotted filled square , data2 plotted filled circle.

is there way this?

the example below previous stackoverflow question worked 1 adds math (perp.) symbol.

p <- p + annotate("text",2005,5, label="e(y)*symbol('\\136')*b", parse=true)  

maybe example helps:

df <- mtcars[,c(5,6,9)] df[,3] <- as.factor(df[,3]) p <- ggplot(df, aes(x=drat,y=wt, fill=am, shape=am)) +               geom_point(size=4)+scale_shape_manual(values=c(21,22)) 

here's plot: enter image description here

the values 21 , 22 refer filled circle , filled square, respectively. see ?points complete list of available symbols.


Comments

Popular posts from this blog

c# - Where does the .ToList() go in LINQ query result -

Listeners to visualise results of load test in JMeter -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -