python_plot畫圖參數設置


# coding:utf-8
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# one_hot數據的讀取
label = pd.read_csv(r'./test/y_pred.csv',header=0,index_col=0)
y_test = pd.read_csv(r'./test/y_test.csv',header=0,index_col=0)
label = label.values
print(label.shape)

x = np.zeros([len(label[:,0])]).reshape(-1,1)
print(x.shape)

n,m = label.shape

x = np.argmax(label,axis=1).reshape(-1,1)
print(np.max(x))
y = np.array(y_test.values).reshape(-1,1)
print(np.max(y))
source = len((x-y)[(x-y)==0])/len(x)

plt.figure('tensorflow-手寫數字',figsize=(12,6))
plt.scatter(list(range(len(x))),x,c=y,label='source={0}'.format(source))
font_size = {'size':15}
plt.title('one_hot-label',font_size)
plt.xlabel('第i個數字',font_size)
plt.ylabel('數字類別',font_size)
plt.legend(loc='upper left')
plt.axis([0,530,0,10])
xlabel = ['數字0','數字1','數字2','數組3','數字4','數字5','數字6','數字7','數字8','數字9']
plt.xticks(range(0,501,100),['第0個','第100個','第200個','第300個','第400個','第500個'])
plt.yticks(range(10),xlabel)
plt.rcParams['font.sans-serif'] = ['SimHei']  # 設置字體為SimHei顯示中文
plt.rcParams['axes.unicode_minus'] = False  # 設置正常顯示符號
plt.show()

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM