如何在ggplot2 geom_freqpoly中增加线条大小?

时间:2018-05-23 12:02:49

标签: r plot ggplot2 graph

我无法在freqpoly图中获得更粗的线条尺寸。当我使用aes(size = 1, ...)时,线条会变得厚重,而#34; 1"不会被解释为以毫米为单位的大小。

这是我的情节代码:

library(ggplot2)
ggplot(data = test4) + geom_freqpoly(aes(size= 4, x=value, color = variable), binwidth = 25, boundary=-0.5)  +
  ggtitle("Freqpoly plot") + labs(y = "Count", x="Length") +
  scale_color_brewer("Species", palette = "Set2") +
  scale_x_continuous(breaks = seq(0,4000,500), labels = c("0", "500","1000","1500","2000","2500",
                                                          "3000","3500",">4000"))+
  scale_y_continuous(breaks = seq(0,1400,100)) +
  theme_linedraw(base_size = 18)+
  theme(plot.title = element_text(hjust = 0.5), 
        axis.title.x = element_text(margin = margin(25,15,15,15,"pt")), 
        axis.title.y = element_text(margin = margin(15,15,15,15,"pt"))) +
  theme(legend.text = element_text(face = "italic"))

测试看起来像:

   variable value
1    C.rip   574
2    C.rip   269
3    C.rip   111
4    C.rip    79
5    C.rip   504
6    C.rip   252

这些图最终会像(with aes(size..)一样,没有:

enter image description here enter image description here

我发现的其他问题的大部分答案仅适用于geom_linegeom_point

这里增加线路尺寸的正确方法是什么?

0 个答案:

没有答案