更改线图大小,了解大小参数如何工作 [英] Change size of a line plot, understand how the size argument works
本文介绍了更改线图大小,了解大小参数如何工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制作带有错误条的多行图。如果我不使用 size
参数,则一切正常:
#sample data
Response = runif(4)
ResponseMin = Response-Response / 5
ResponseMax = Response + Response / 5
Cases = rep(c(Case1, case2),each = 2)
df = data.frame(x = 1:2,Average = Response,Lower = ResponseMin,Upper = ResponseMax,Case = Cases)
#let's plot
library(ggplot2)
ggplot(df,aes(x = x,y = Average,color = Case))+
geom_line(aes(group = Case))+
geom_point )+
geom_errorbar(aes(ymin = Lower,ymax = Upper,width = 0.25))+
labs(y =foo,title =Some plot fu)
然而,当我修改线的大小,我开始变得奇怪的东西:
ggplot(df,aes(x = x,y =平均,color = Case))+
geom_line(aes(group = Case,size = 1))+
geom_point( )+
geom_errorbar(aes(ymin = Lower,ymax = Upper,width = 0.25))+
labs(y =foo,title =Some plot fu)
为什么额外的图例条目为1?当我为errobars添加一个 size
参数时,无论 size $的值如何,它看起来像这些行的大小保持不变c $ c>是:
ggplot(df,aes(x = x,y = Average,color = Case))+
geom_line(aes(ymin = Lower,ymax = Upper,width = 0.25,size = 1)geom_line()(aes(group = Case,size = 1))+
geom_point()+
geom_errorbar )+
labs(y =foo,title =一些情节)
ggplot(df,aes(x = x,y = Average ,color = Case))+
geom_line(aes(group = Case,size = 2))+
geom_point()+
geom_errorbar(aes(ymin = Lower,ymax = Upper,width = 0.25,size = 2))+
labs(y =foo,title =Some plot fu)
查看全文