这与以下关于在 R 中的 ggplot2 中对齐子图的帖子相关:
Scatterplot with marginal histograms in ggplot2
How to plot Scatters with marginal density plots use Python?
StackOverflow 上有更多关于此主题的链接。
无论如何,我找不到任何关于如何在 Python 中使用 Plotnine(ggplot2 实现)执行此操作的文档。
这完全可以用 Python 完成吗?如果没有,是否没有解决此问题的需求?
感谢您的指导。
更新:
我找到了这个链接 MEP for a matplotlib geometry manager #1109 这似乎表明该功能现在存在于 matplotlib 中以执行此操作。问题是 plotnine 是否已扩展以执行此操作?
最佳答案
所以我对 plotnine 的了解还不够多,无法说明它是否可以做到这一点,但在 seaborn 中非常容易:https://seaborn.pydata.org/generated/seaborn.jointplot.html
>>> import numpy as np, pandas as pd; np.random.seed(0)
>>> import seaborn as sns; sns.set(style="white", color_codes=True)
>>> tips = sns.load_dataset("tips")
>>> g = sns.jointplot(x="total_bill", y="tip", data=tips)
关于python - Python 中是否有 gridExtra/cowplot 类型包与 Plotnine 一起使用以对齐子图(即边际分布),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58775754/