2024-04-25 20:31:07 发布
网友
在单轴上操作的seaborn函数可以将一个作为参数。
例如,要^{}的文档包括:
ax : matplotlib axis, optional Axis to plot on, otherwise uses current axis
如果你这么做了:
df = function_to_load_my_data() fig, ax = plt.subplots()
你可以这样做:
seaborn.kdeplot(df['col1'], ax=ax) seaborn.kdeplot(df['col2'], ax=ax)
一种解决方案是引入二级轴:
fig, ax = plt.subplots() sb.regplot(x='round', y='money', data=firm, ax=ax) ax2 = ax.twinx() sb.regplot(x='round', y='dead', data=firm, ax=ax2, color='r') sb.plt.show()
这些数据是关于私有和公共拼贴数据的,但是可以工作,正如我们看到的,我们将所有全局参数加载到seaborn对象,然后我们将图表映射到同一个窗格。
import seaborn as sns import matplotlib.pyplot as plt import pandas as pd df = pd.read_csv('College_Data',index_col=0) g = sns.FacetGrid(df,hue='Private',palette='coolwarm',size=6,aspect=2) g.map(plt.hist,'Outstate',bins=20,alpha=0.7)
See Chart
在单轴上操作的seaborn函数可以将一个作为参数。
例如,要^{} 的文档包括:
如果你这么做了:
你可以这样做:
一种解决方案是引入二级轴:
这些数据是关于私有和公共拼贴数据的,但是可以工作,正如我们看到的,我们将所有全局参数加载到seaborn对象,然后我们将图表映射到同一个窗格。
See Chart
相关问题 更多 >
编程相关推荐