changing line width in stat_qq (with ggplot, in r)

◇◆丶佛笑我妖孽 提交于 2019-12-25 02:38:30

问题


I am using ggplot with stat_qq to plot several samples.

I am trying to figure out how to change the width of the lines in the chart with no luck :-(

Here is (the relevant part of) my code:

ggplot(data=df,aes(sample=obser, colour = sample)) + 
stat_qq(dist=qunif) + 
scale_color_manual(values = c("samp_a" = "darkturquoise", "samp_b" = "hotpink", "samp_c" = "darkgrey")) + 
scale_x_continuous(breaks=x_ax) +
scale_y_continuous(breaks=y_ax) + 
theme(axis.text.x = element_text(angle = 90, hjust = 1,size = 10)) +
theme(panel.background = element_rect(fill='white', colour='grey')) +
theme(panel.grid.major = element_line(colour="lightgrey", size=0.5), panel.grid.minor = element_blank())

My current plot looks like this:

Any idea how to do it? I tried adding size to aes in ggplot with no luck and could not figure out the explanation about mapping for stat_qq:

http://docs.ggplot2.org/0.9.3/stat_qq.html

Thanks!!!


回答1:


You are mistaken in the belief that you are dealing with lines. You have many points and want to change the point size. Here is a simple example:

y <- rt(200, df = 5)
ggplot(data.frame(y), aes(sample=y)) +stat_qq(size=1)

There is a minimum possible point size.

If you want lines, you can use this:

ggplot(data.frame(y), aes(sample=y)) +stat_qq(geom="line", size=0.5)

The minimum line size is smaller than the minimum point size.



来源:https://stackoverflow.com/questions/20499216/changing-line-width-in-stat-qq-with-ggplot-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!