diff --git a/盘荣博/图/figure10_9.png b/盘荣博/图/figure10_9.png index b184056..ca82307 100644 Binary files a/盘荣博/图/figure10_9.png and b/盘荣博/图/figure10_9.png differ diff --git a/盘荣博/图/例10.py b/盘荣博/图/例10.py index c97f2a0..ed45820 100644 --- a/盘荣博/图/例10.py +++ b/盘荣博/图/例10.py @@ -25,4 +25,4 @@ nx.draw_networkx_edge_labels(G,pos,edge_labels=w)#绘制标签 path_edges=list(zip(p,p[1:])) print(type(path_edges),"\npath_edges=",path_edges) nx.draw_networkx_edges(G,pos,edgelist=path_edges,edge_color="r",width=1) -plt.savefig("figure10_9.png");plt.show() \ No newline at end of file +plt.savefig("figure10_9.png",dpi=1000);plt.show() \ No newline at end of file diff --git a/盘荣博/数据可视化/shuju.jpg b/盘荣博/数据可视化/shuju.jpg new file mode 100644 index 0000000..2c8e7da Binary files /dev/null and b/盘荣博/数据可视化/shuju.jpg differ diff --git a/盘荣博/数据可视化/week1.py b/盘荣博/数据可视化/week1.py index 12f7640..74a1462 100644 --- a/盘荣博/数据可视化/week1.py +++ b/盘荣博/数据可视化/week1.py @@ -1,9 +1,42 @@ import pandas as pd +from scipy.stats import zscore import matplotlib.pyplot as plt +from matplotlib.pyplot import ylabel df = pd.read_excel("棉花产量论文作业的数据.xlsx") -plt.plot(df["年份"],df["单产"]) +# plt.plot(df["年份"],df["单产"]) plt.rcParams['font.sans-serif']="SimHei" -plt.ylabel('单产') -plt.xlabel('年份') -plt.show() -print(df) \ No newline at end of file +# plt.rcParams['size'] =10 +# plt.ylabel('单产') +# plt.xlabel('年份') + +# print(df) +d = df.to_numpy()[:,1:] +print(d) +plt.subplot(4,1,1) +plt.scatter(d[:,:1],d[:,1:2],c='r') +ylabel('原始数据'),plt.title("单产和种子费用的关系") +#公式调用标准化,遵守标准正态分布 +data = zscore(d) +print(data) +plt.subplot(4,1,2) +plt.scatter(data[:,:1],data[:,1:2],c='b',) +ylabel('zscore') + +print(d.max(axis=0)) +print(d.std(axis=0)) +print(d.mean(axis=0)) +#手写标准正态分布 +data1=(d-d.mean(axis=0))/d.std(axis=0) +print(data1) +plt.subplot(4,1,3) +plt.scatter(data1[:,:1],data1[:,1:2],c='y') +ylabel('手写标准正态分布') + +data2=(d-d.min(axis=0))/(d.max(axis=0)-d.min(axis=0)) +plt.subplot(4,1,4) +plt.scatter(data2[:,:1],data2[:,1:2],c='g') +plt.xlabel('压缩到0~1') +print(data==data1) + +plt.savefig("shuju.jpg",dpi=2000) +plt.show() \ No newline at end of file