Removing Unused Factors from a Facet in ggplot2

前端 未结 1 1209
悲&欢浪女
悲&欢浪女 2020-12-11 05:10

I am trying to figure out a neat way to remove unused factors from a facet in ggplot2. Here is a minimal example

# DUMMY DATA
mydf = data.frame(
  x = rpois(         


        
相关标签:
1条回答
  • 2020-12-11 05:28

    I think all you need is scales = "free_y":

    p0 = ggplot(mydf, aes(x = x, y = y)) +
      geom_point() +
      facet_wrap(~ cat, ncol = 1,scales = "free_y")
    
    p0
    

    enter image description here

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