Something like the data bar on the right
How to add illustrative bar in ggplot2 for 3 dataframes together in one plot in R?
I need to add illustrative bar beside the chart to illustrates every data for example: orange circle is for effect, blue rectangular for SD and so on.
ggplot() +
geom_point(data = significance, aes(s.dist,-log2(p.adjustMANOVA)),
fill = "darkorange1", color = "black",
size = 7, shape = 21)+
geom_point(data = effect, aes(s.dist,-log2(p.adjustMANOVA)),
fill = "cornflowerblue", color = "black",
size = 5, shape = 22)+
geom_point(data = SD, aes(s.dist,-log2(p.adjustMANOVA)),
fill = "deeppink1", color = "black",
size = 4, shape = 23)+
labs(x = "s.dist", y = "p.adjustMANOVA")+
ggtitle("Significance vs Effect_size vs Standard_error")
1 answer
Do you have an example of what you want the final product to look like?
What you are looking for is a legend. ggplot2 will automatically create one, if you combine your data into one dataframe beforehand (with a column each for x,y, and category) and just add one geom_point() layer. Please see the examples how to map the categorical variable to shape and color via aes().
Thanks, yes you are right I combined the data in one dataframe but I did it on python with pandas and plot it with matplotlib.
Log in to answer this question.