相关疑难解决方法(0)

使用matplotlib面向对象的界面用seaborn绘图

我更喜欢使用matplotlibOOP风格:

f, axarr = plt.subplots(2, sharex=True)
axarr[0].plot(...)
axarr[1].plot(...)
Run Code Online (Sandbox Code Playgroud)

这样可以更轻松地跟踪多个图形和子图.

问题:如何使用seaborn这种方式?或者,如何将此示例更改为OOP样式?如何将seaborn绘图函数描述为lmplot哪个Figure或哪个Axes绘图?

python oop matplotlib seaborn

93
推荐指数
1
解决办法
6万
查看次数

如何在Subplot中绘制多个Seaborn Jointplot

我在将Seaborn Jointplot放在多列中时遇到了问题subplot.

import pandas as pd
import seaborn as sns

df = pd.DataFrame({'C1': {'a': 1,'b': 15,'c': 9,'d': 7,'e': 2,'f': 2,'g': 6,'h': 5,'k': 5,'l': 8},
          'C2': {'a': 6,'b': 18,'c': 13,'d': 8,'e': 6,'f': 6,'g': 8,'h': 9,'k': 13,'l': 15}})

fig = plt.figure();   
ax1 = fig.add_subplot(121);  
ax2 = fig.add_subplot(122);

sns.jointplot("C1", "C2", data=df, kind='reg', ax=ax1)
sns.jointplot("C1", "C2", data=df, kind='kde', ax=ax2)
Run Code Online (Sandbox Code Playgroud)

注意如何只将一部分jointplot放置在子图内,其余部分留在另外两个图框内.我想要的是distributions同时插入内部subplots.

有人能帮忙吗?

python matplotlib python-3.x pandas seaborn

34
推荐指数
4
解决办法
2万
查看次数

标签 统计

matplotlib ×2

python ×2

seaborn ×2

oop ×1

pandas ×1

python-3.x ×1