r - My probability plot and log scales do not line up with my gridlines (using ggplot) -
i'm trying create plot in x-axis has probability scale , y-axis log-10-scaled. i'll start data, can found text file here: http://m.uploadedit.com/b018/1374626091664.txt
i want plot 2 data series based on factor "site", can see data. well, when go plot data, naturally use scale_x_continuous
trans='probit'
option generate probability plot scale. generated vector of breaks use probability axis, named ybreaks
:
ybreaks <- c(1,2,5,10,20,30,40,50,60,70,80,90,95,98,99,99.5,99.9)/100
ggplot(site1a, aes(x=prob, y=volume))+ geom_point(aes(colour=factor(site)))+ geom_line(aes(colour=factor(site)))+ scale_x_continuous(trans='probit', minor_breaks=ybreaks)+ scale_y_log10(labels = comma, breaks=c(.001,.01,.1,1,10,100))+ labs(x="exceedance probability", y="volume (cubic feet)")+ scale_colour_discrete(name="location", breaks=c("x1ain","x1aout"), labels=c("in","out"))+ theme(panel.background = element_rect(fill='#ffffff', colour = 'gray'), axis.text.y = element_text(colour="black", size=18), axis.text.x = element_text(colour="black", size=12), axis.title.y = element_text(size=24), axis.title.x = element_text(size=24, vjust=.1), legend.text=theme_text(size=23), legend.title=theme_text(size=23), legend.title=element_text())
plot of code shown below:
as can see, i'm trying minor gridlines probability axis line actual breaks, seems shrunken unknown scale. also, scale log axis off (the breaks i'm specifying aren't lining axis intervals log10 scale). how correct this? input might have.
apparently minor_breaks not transform itself. should work if use transform qnorm
:
scale_x_continuous(trans='probit', minor_breaks=qnorm(ybreaks))
Comments
Post a Comment