如何使用熊猫绘制散点矩阵的一半

时间:2019-08-06 00:12:07

标签: python pandas matplotlib

我正在使用pandas scatter_matrix(无法在Seaborn中使PairgGrid正常工作)来绘制pandas框架中一组列的所有组合。每列为1000个数据点,共有9列。

我正在使用以下代码:

pandas.plotting.scatter_matrix(df, alpha=0.2, figsize=(8,8))

我得到如下图所示:

enter image description here

这很好。但是,您会注意到在主对角线上有一个镜像。是否有可能像我用油漆制作的以下假图所示那样只绘制下部:

enter image description here

1 个答案:

答案 0 :(得分:2)

这可能不是最干净的方法,但它可行:

# New Code
def item_author_name(self, item):
        print('Being Called')
        return item.author
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

enter image description here