您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何修改pandas图的整合?

如何修改pandas图的整合?

pd.tools.plotting.scatter_matrix返回绘制轴的数组;左下边界轴对应于索引[:,0][-1,:]。可以遍历这些元素并进行各种修改。例如:

axs = pd.tools.plotting.scatter_matrix(df, diagonal='kde')

def wrap(txt, width=8):
    '''helper function to wrap text for long labels'''
    import textwrap
    return '\n'.join(textwrap.wrap(txt, width))

for ax in axs[:,0]: # the left boundary
    ax.grid('off', axis='both')
    ax.set_ylabel(wrap(ax.get_ylabel()), rotation=0, va='center', labelpad=20)
    ax.set_yticks([])

for ax in axs[-1,:]: # the lower boundary
    ax.grid('off', axis='both')
    ax.set_xlabel(wrap(ax.get_xlabel()), rotation=90)
    ax.set_xticks([])

分散

其他 2022/1/1 18:41:50 有316人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶