Almost the exact same question as ggplot exact axis range, except I also need to reverse the y-axis from top to bottom. reprex directly from above
myData = data.frame(x = c(0, 1, 2, 3, 4, 5),
y = c(0.05,0.06, 0.07, 0.08, 0.09, 0.09))
ggplot() +
geom_step(data=myData, aes(x=x, y=y), color='blue', size=1) +
xlab('') +
ylab('') +
scale_x_continuous(expand = expand_scale(), limits = c(0,5))+
scale_y_continuous(labels = scales::percent, expand = expand_scale(), limits = c(0,0.12))
#adding reverse goes wrong
ggplot() +
geom_step(data=myData, aes(x=x, y=y), color='blue', size=1) +
xlab('') +
ylab('') +
scale_x_continuous(expand = expand_scale(), limits = c(0,5))+
scale_y_continuous(labels = scales::percent, expand = expand_scale(), limits = c(0,0.12), trans="reverse")