[R-sig-Geo] Changing the line type of probability density curve in R

r@i@1290 m@iii@g oii @im@com r@i@1290 m@iii@g oii @im@com
Tue Jul 25 17:50:37 CEST 2023


I am trying to change the line type of a density curve, just so that it stands out relative to the rest of the density curves that I have on the same plot. However, the issue is that when I use the "linetype" function to make a dashed curve (i.e. linetype=2), there is no error, but the actual line type remains only solid in the generated plot. This is what I tried:
    Globalpdf <- ggplot() + geom_density(data=GEV[1:5,], mapping = aes(x=GLocation45),     color="black", size=3) + geom_density(data=GEV[16:20,], mapping = aes(x=GLocation45),     color="black", size=3, linetype=2) + geom_density(data=GEV[29:33,], mapping =     aes(x=GLocation45), color="blue",size=3) + geom_density(data=GEV[1:5,], mapping =     aes(x=GLocation85), color="black", size=3) + geom_density(data=GEV[16:20,], mapping =     aes(x=GLocation85), color="black", size=3) + geom_density(data=GEV[29:33,], mapping =     aes(x=GLocation85), color="red", size=3) + geom_density(data=GEV[1:5,], mapping =     aes(x=GLocationco), color="green", size=3) + geom_density(data=GEV[16:20,], mapping =     aes(x=GLocationco), color="green", size=3) + geom_density(data=GEV[29:33,], mapping =     aes(x=GLocationco), color="green", size=3) + xlab("One-day max (mm/day)") + ggtitle("Global")     + xlim(150, 300)+theme(plot.title = element_text(size=54))+     theme(axis.title=element_text(size=54)) + theme(axis.text=element_text(size=54)) +     theme(panel.background = element_blank())

Doing this correctly produces the series of pdf curves on the plot, as shown below, but the second black curve that I specified to appear as "dashed" remains as a solid black curve, rather than the desired dashed black curve. It is only that one that I require to appear as dashed. Is there a reason for this happening?
Any help with this would be greatly appreciated! 
Thanks,

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list