导航互动Matplotlib

时间:2018-08-13 03:32:01

标签: python matplotlib

谁知道,为什么没有出现matplotlib交互导航? Click to see the picture Picture 如何再次显示? 这是我的代码:

        df = pd.read_csv('cluster/export/with_reduction+label_dataset.csv')
        finalDf = df.iloc[:, 1:]
        print(type(finalDf))
        fig = plt.figure(figsize=(10, 10), dpi=80)
        # height, width, plot
        ax = fig.add_subplot(1, 1, 1)
        ax.set_xlabel('X', fontsize=15)
        ax.set_ylabel('Y', fontsize=15)
        ax.set_title('Testing', fontsize=20)

        targets = ['Iman', 'Wudlu', 'Mandi', 'Haidl', 'Shalat', 'Adzan', 'Shaum']
        colors = ['r', 'g', 'b', 'crimson', 'chocolate', 'orange', 'violet']
        for target, color in zip(targets, colors):
            indicesToKeep = finalDf['nm_bab'] == target
            ax.scatter(finalDf.loc[indicesToKeep, 'component_1']
                       , finalDf.loc[indicesToKeep, 'component_2']
                       , c=color
                       , s=60
                       , label=target
                       , marker='o')
        # ax.plot()
        ax.legend()
        ax.grid()
        plt.show()

0 个答案:

没有答案