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

前端 未结 3 2116
误落风尘
误落风尘 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:13

    You need ggvis to do that:

    library(ggvis)
    dfn %>% ggvis(~dose, ~length, fill= ~supp, stroke=~supp) %>% layer_lines(fillOpacity=0) %>%
      scale_numeric('y', reverse=T) %>% add_axis('x',orient='top')
    

    enter image description here

提交回复
热议问题