Is it yet possible to have different axis breaks / limits for individual facets in ggplot with free scale?

后端 未结 1 445
感情败类
感情败类 2020-12-20 06:57

I saw that this related question was asked in 2010 (titled: How do you set different scale limits for different facets?) and would like to know if it is yet possible to have

相关标签:
1条回答
  • 2020-12-20 07:17

    First, your code doesn't produce the same plot as on my machine. Can you provide the sessionInfo()?

    I don't think it is possible. Best approximation of your request I could achieve in a simple way:

    ggplot(dat.m, aes(date,  value)) + 
          scale_x_continuous(name="Time") + 
          expand_limits(y=0) +
          ylab("Variable") + 
          geom_step() + 
          facet_grid(variable~., scales="free_y")+ 
          scale_y_continuous(breaks = c(seq(0, 12, by = 2),seq(0, 150, by = 50)))
    

    enter image description here

    0 讨论(0)
提交回复
热议问题