我有一个线性比例的散点图。我想在散点图like this figure和Marginal Histograms and Box Charts的边距(左下角)添加一个方框图?在
更新 这是我目前的工作解决方案,分享你的想法或提出更好的建议。在
ax.plot(df['vcnt'], df['ecnt'], 'ko', alpha=0.5)
# Save the default tick positions, so we can reset them..
tcksx = ax.get_xticks()
tcksy = ax.get_yticks()
ax.boxplot(df['ecnt'], positions=[min(tcksx)], notch=True, widths=1.)
ax.boxplot(df['vcnt'], positions=[min(tcksy)], vert=False, notch=True, widths=1.)
ax.set_yticks(tcksy) # pos = tcksy
ax.set_xticks(tcksx) # pos = tcksx
ax.set_yticklabels([int(j) for j in tcksy])
ax.set_xticklabels([int(j) for j in tcksx])
ax.set_ylim([min(tcksy-1),max(tcksy)])
ax.set_xlim([min(tcksx-1),max(tcksx)])
您可以通过为条形图创建额外的
axes
来实现这一点。在相关问题 更多 >
编程相关推荐