I want to compare different peaks from histograms, so I put two of them into one plot with alpha=0.5. The default output in RStudio looks fine, but when I use pdf() or ggsave() or even CairoPDF() the resulting output has solid lines around the boxes. In my case these solid lines sometimes look very ugly when zooming the pdf display. I want to disable these solid lines or at least have the lines to be the same color/alpha as the filling.
Minimal Code Example:
library(ggplot2)
p1<-ggplot()+
geom_histogram(data=diamonds[diamonds$cut == "Premium",],aes(x=depth,fill=cut),alpha=0.5)+
geom_histogram(data=diamonds[diamonds$cut == "Ideal",],aes(x=depth,fill=cut),alpha=0.5)
ggsave("histoline.pdf",p1)
this is the output:
I have tried various ways to modify linetypes and sizes but have not succeeded until now.