ggplot2、facet_grid、自由比例尺? [英] ggplot2, facet_grid, free scales?

查看:42
本文介绍了ggplot2、facet_grid、自由比例尺?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下示例中,如何根据每个面板中的数据获取 y 轴限制以进行缩放?

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(cyl))) + geom_point() 

这些都不会:

mt + facet_grid(. ~ cyl, scales="free")
mt + facet_grid(. ~ cyl, scales="free_y")

推荐答案

也许是因为你只有一个 y 轴,按照你的方式.你有没有尝试过这样的事情?

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")

这篇关于ggplot2、facet_grid、自由比例尺?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆