2

I am having trouble getting the line sizes in my freqpoly plot a little thicker. When I use aes(size = 1, ...), the lines become way to thick and "1" is not interpreted as the size in millimeters.

Here's the code for my plot:

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"))

And test looks like:

   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

The plots end up like this, (with aes(size..) and without:

enter image description here enter image description here

Most of the answers I found for other questions were only for geom_line or geom_point.

Whats the correct way to increase line size here?

GGamba
  • 13,140
  • 3
  • 38
  • 47
voiDnyx
  • 975
  • 1
  • 11
  • 24
  • For this second plot, where you don't put size in your `aes`, where *do* you put size for the freqpoly? – camille May 23 '18 at 12:26
  • Nowhere, I used the default. – voiDnyx May 23 '18 at 12:51
  • 5
    Okay, so you need to set the size to what you want. You can give a size argument inside `geom_freqpoly` but outside `aes`. Try `size = 1`, see how you like it, then adjust the size if you need to – camille May 23 '18 at 13:00
  • 2
    Camille is correct, setting size needs to be done outside `aes`, e.g.: `+ geom_freqpoly(aes(x=value, color = variable), size= 4, binwidth = 25, boundary=-0.5)` – Axeman May 23 '18 at 13:28
  • Thank you, I knew I had to be missing something trivially easy here - just couldnt figure out what. :) – voiDnyx May 23 '18 at 13:46

0 Answers0