如何调整 geom_line 中的线条大小而不获取另一个(无用的)图例?
我想调整我的线条(两条)的大小,因为我觉得它们太瘦了。 以下代码执行此操作,但创建了 size 的图例,这是无用的,因为 size 没有可以映射到它的变量。
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")
我的图由两条线组成,代表同一时间跨度内两个不同变量的时间序列。该变量映射为颜色。如果我尝试影响线条的大小,qplot 总是尝试将“大小”映射到另一个参数并显示另一个图例。
我还关注了此讨论,最终以 Hadley 结束告诉其他人删除部分图例尚未实现。 据我所知,向混合中添加另一个参数意味着需要该参数的图例。也许我只是出于视觉原因使用了错误的命令来影响线条大小。
感谢您的任何建议!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信在
qplot()
中,所有美学设置都被解释为在aes()
内。如果您不希望尺寸设置出现在图例中,请按原样用I()
包裹该值。现在不应该有尺寸图例了。
另一件需要注意的事情是,现在可以从图例中消除美学尺度。例如,如果您想以更困难的方式删除尺寸比例,您可以这样做
I believe in
qplot()
all aesthetic settings are interpreted as being withinaes()
. If you don't want your size setting to appear in the legend, wrap the value withI()
for as-is.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