make geom_step behave like geom_path

Viewed 48

I would like to make a vertically oriented step plot where the steps behave like in geom_path (are plotted in the order they appear in the dataframe)

I've tried this:

tib <- tibble(x = c(0, 2, 1, 3, 4),
       y = 0:4)

tib %>%
  ggplot(aes(x, y)) +
  geom_point() +
  geom_path(colour = 'red') +
  geom_step()

enter image description here

and this is what I want to achieve, but is there a way without having to resort to coord_flip?

enter image description here

tib %>%
  ggplot(aes(y, x)) +
  geom_point() +
  geom_path(colour = 'red') +
  geom_step() +
  coord_flip()
0 Answers
Related