Hi,
I want to draw a plot with both geom_point() and geon_segment(), and I need to adjust the size of the points or the lines in the plot. It is easy to do this with scale_size(range= c(0,any value)).
An example plot code:
ggplot(data = data.frame(a=1:3,b=2:4,s=3:5,c=as.character(4:6)))+
geom_segment(mapping = aes(x=a,xend=b,y=b,yend=a,size=s))+
geom_point(mapping = aes(x=a,y=b,size=s,color=c))+
scale_size(range(0,5))
But if i want to set different range to points and lines, i found i can't do that because a ggplot() can have only one scale. I cant set a range of c(0,5) to points and set a different range of c(0,2) to the lines.
I usually the same problem encounter the same problem when i want to set more than one scale of color to different layers in one plot.
I have solved the problem by modifing the GeomPoint and geom_point(), set a new aes name like point_size to make it separate from the normal size aes.
But i don't think all the ggplot2 users can do this and maybe there is any "normal way" or "offical way" to set different size in one ggplot() without modifing the original code?