我试图绘制一个图,该图有大数字和小数字,因此我为此做了一个简单的例子。问题是图的结尾不可见,因此在报告中效果不佳。 100值后图片不清晰,所以如果数据太小怎么办?
import matplotlib.pyplot as plt
import numpy as np
a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]
b1=[2000,1800,1750,100,90,80,70,75,80,70,74,60,20,15,12,12,14,14,14,14,12,11,12,0.3,0.6,0.6,0.7,0.6]
b2=[2000,1800,1750,100,90,80,70,75,80,70,74,60,20,15,12,12,14,14,14,14,12,11,12,0.3,0.6,0.6,0.7,5]
b3=[2000,1800,1750,100,90,80,70,75,80,70,74,60,20,15,12,12,14,14,14,14,12,11,12,0.3,0.6,0.6,0.7,54]
c=[0,3]
scaled_a = np.interp(a, (min(a), max(a)), c)
print(scaled_a)
plt.subplot(311)
plt.plot(scaled_a,b1,'r')
plt.annotate('%0.2f' % b1[-1], xy=(1, b1[-1]), xytext=(8, 0),
xycoords=('axes fraction', 'data'), textcoords='offset
points')
plt.subplot(312)
plt.plot(scaled_a,b2,'b')
plt.annotate('%0.2f' % b2[-1], xy=(1, b2[-1]), xytext=(8, 0),
xycoords=('axes fraction', 'data'), textcoords='offset points')
plt.subplot(313)
plt.plot(scaled_a,b3,'g')
plt.annotate('%0.2f' % b3[-1], xy=(1, b3[-1]), xytext=(8, 0),
xycoords=('axes fraction', 'data'), textcoords='offset points')
plt.show()