[英]pandas histogram with by: possible to make axes uniform?
I am using the option to generate a separate histogram of a value for each group in a data frame like so (example code from documentation)我正在使用该选项为数据框中的每个组生成单独的值直方图,如下所示(文档中的示例代码)
data = pd.Series(np.random.randn(1000))
data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4))
This is great, but what I am not seeing is a way to set and standardize the axes.这很棒,但我没有看到设置和标准化轴的方法。 Is this possible?这可能吗?
To be specific, I would like to specify the x and y axes of the plots so that the y axis in particular has the same range for all plots.具体来说,我想指定图的 x 和 y 轴,以便特别是 y 轴对于所有图具有相同的范围。 Otherwise it can be hard to compare distributions to one another.否则很难将分布相互比较。
you can pass kwds
to hist and it will pass them along to appropriate sub processes.您可以将kwds
传递给 hist,它会将它们传递给适当的子进程。 The relevant ones here are sharex
and sharey
这里相关的是sharex
和sharey
data = pd.Series(np.random.randn(1000))
data.hist(by=np.random.randint(0, 4, 1000), figsize=(6, 4),
sharex=True, sharey=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.