ggplot2, facet_grid, free scales?

前端 未结 4 1949
广开言路
广开言路 2020-11-27 18:11

In the following example, how do I get the y-axis limits to scale according to the data in each panel?

mt <- ggplot(mtcars, aes(mpg, wt, colour = factor(c         


        
相关标签:
4条回答
  • 2020-11-27 18:41

    Perhaps it's because you have only one y axis, using your way. Did you try something like this?

    mt + facet_grid(cyl ~ ., scales="free")
    
    0 讨论(0)
  • 2020-11-27 18:53

    Hopefully, this helps.

    mt + facet_wrap(. ~ cyl, scales="free_y")
    
    0 讨论(0)
  • 2020-11-27 18:53

    If you come looking for a python implementation, you need sharex=False, sharey=False.

    g = sns.FacetGrid(df,  row='row_col_name' col="col_col_name",sharex=False,sharey=False)
    
    0 讨论(0)
  • 2020-11-27 18:59

    You can't. See here

    You can use facet_wrap instead, which will 'free' both axes

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