简体   繁体   中英

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. 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")  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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