简体   繁体   English

禁止显示大熊猫中的所有标签scatter_matrix

[英]Suppressing all labeling in pandas scatter_matrix

I'm producing a scatterplot matrix using the scatter_matrix function in pandas.tools.plotting and since I have a lot of variables the labels end up looking very messy. 我使用了该散点图矩阵scatter_matrix在功能pandas.tools.plotting ,因为我有很多的变量标签最终看起来很凌乱。 Is there a way to suppress all the labels and perhaps even the tick marks? 有没有一种方法可以抑制所有标签甚至刻度线? Here is some code that shows essentially what I mean: 这是一些代码,基本上说明了我的意思:

import numpy as np
from pandas import DataFrame, scatter_matrix

n = 50
p = 15

cols = ['var_' + str(k) for k in range(p)]

data = DataFrame(np.random.randn(n, p), columns = cols)
scatter_matrix(data, diagonal = 'kde')

在此处输入图片说明

This works for me: 这对我有用:

    sm = scatter_matrix(data, diagonal = 'kde')
    for subaxis in sm:
        for ax in subaxis:
            ax.xaxis.set_ticks([])
            ax.yaxis.set_ticks([])
            ax.set_ylabel("")
            ax.set_xlabel("")
    pic = sm[0][0].get_figure()  
    pic.savefig("MyScatter.png")  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM