# '斑块间欧氏距离平均值T
#导包
import pandas as pd
import matplotlib.pyplot as plt
import os
%matplotlib inline
#全局按新罗马字体格式
plt.rc('font',family='Times New Roman')
#定义路径
os.chdir('F://熊欢//3.9图像')
#读取数据
su=pd.read_excel('制图(熊欢).xlsx',sheet_name=1)
#数据准备
x=['mid-Holocene','Current','2070(RCP26)','2070(RCP45)','2070(RCP60)','2070(RCP85)']
y1=su.iloc[0]
y2=su.iloc[1]
y3=su.iloc[2]
y4=su.iloc[3]
#定义画布
fig = plt.figure(figsize=(10,6),dpi=300)
#多子图设置
plt.subplot(2,2,1)
plt.plot(x,y1,'steelblue',linewidth=3)
xs=[1,2,3,4,5,6]
con=[0.4857*x+49.002 for x in xs]
plt.plot(x,con,'steelblue',linestyle='--')
plt.xticks(x,color='white')
plt.title('Gansu',fontsize=12)
plt.subplot(2,2,2)
plt.plot(x,y2,'darkorange',linewidth=3)
xs1=[1,2,3,4,5,6]
con1=[0.9571*x+50.23 for x in xs1]
plt.plot(x,con1,'darkorange',linestyle='--')
plt.xticks(x,color='white')
plt.title('Qinghai',fontsize=12)
plt.subplot(2,2,3)
plt.plot(x,y3,'forestgreen',linewidth=3)
xs2=[1,2,3,4,5,6]
con2=[0.7849*x+59.815 for x in xs2]
plt.plot(x,con2,'forestgreen',linestyle='--')
plt.title('Sichuan',fontsize=12)
plt.xticks(size='small',rotation=30,fontsize=9)
plt.subplot(2,2,4)
plt.plot(x,y4,'r',linewidth=3)
xs3=[1,2,3,4,5,6]
con3=[1.48*x+48.921 for x in xs3]
plt.plot(x,con3,'r',linestyle='--')
plt.title('Tibet',fontsize=12)
plt.xticks(size='small',rotation=30,fontsize=9)
fig.savefig('斑块间欧氏距离平均值T')
plt.show()