i´d like to adjust the size of my lines (both of them), because i feel they're too skinny. The following code does so, but creates a legend for size, which is useless since size has no variable that can be mapped to it.
qplot(date,value,data=graph1,geom="line",colour=variable,xlab="",ylab="",size=1)
+ scale_y_continuous(limits = c(-0.3,0.3)) + opts(aspect.ratio = 2/(1+sqrt(5)))
+ scale_colour_manual("Variable",c(Line1="red",Line2="blue"))
+ opts(legend.size="none")
My plot consists of two lines representing a time series of two different variables over the same time span. The variable is mapped to color. If I try to influence the size of the line, qplot always tries to map "size" to another parameter and display another legend.
I also followed this discussion, that ended with Hadley telling the others that removing a part of the legend is not implemented yet. I understand that adding another paramater to the mix implies the need of a legend for this parameter. Maybe I am using the wrong command to influence line size just for visual reasons.
Thx for any suggestions!
I believe in qplot()
all aesthetic settings are interpreted as being within aes()
. If you don't want your size setting to appear in the legend, wrap the value with I()
for as-is.
qplot(date, value,data=graph1,
geom="line",
colour=variable,xlab="",
ylab="",
size= I(1))+
scale_y_continuous(limits = c(-0.3,0.3))+
scale_colour_manual("Variable",c(Line1="red",Line2="blue"))+
opts(legend.size="none",
aspect.ratio = 2/(1+sqrt(5)))
Now there shouldn't be a size legend.
Another thing to note is that eliminating an aesthetic scale from the legend is now possible. If, for instance, you wanted to remove the size scale a harder way, you could do
last_plot() + scale_size(legend = F)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With