Plot with reversed y-axis and x-axis on top in ggplot2

前端 未结 3 2120
误落风尘
误落风尘 2021-01-06 02:43

I\'m trying to get ggplot2 plot with reversed y-axis and x-axis on top. I used scale_y_reverse() to get reversed y-axis but could not figured out h

3条回答
  •  借酒劲吻你
    2021-01-06 03:15

    Now even easier with ggplot v2.2.0:

    p1 <- ggplot(data=dfn, aes(x=dose, y=length, group=supp, colour=supp)) + geom_line() + geom_point()
    p1 <- p1 + scale_y_reverse() + scale_x_continuous(position = 'top')
    print(p1)
    

提交回复
热议问题