对于一些数据集,这是我的代码
import matplotlib.pyplot as plt
year = []
relative_recurrence = []
f = open('relative recurrence plot.txt','r')
for row in f:
row = row.split(' ')
year.append(row[0])
relative_recurrence.append(float(row[1]))
plt.bar(year, relative_recurrence,color = 'g', label = 'HILDCAAS')
x 轴上的值范围从 1975 年到 2017 年。 y 轴上的值是一些十进制值。在绘图的 x 轴上,值重叠。我想将比例更改为 1975,1980,1985 以保持它们清晰可见。请建议所需的命令。我试过 xlim() 命令。但它没有用。
尝试这个:
import matplotlib.pyplot as plt
year = []
relative_recurrence = []
f = open('relative recurrence plot.txt','r')
for row in f:
row = row.split(' ')
year.append(float(row[0]))
relative_recurrence.append(float(row[1]))
plt.bar(year, relative_recurrence,color = 'g', label = 'HILDCAAS')
plt.xticks(np.arange(min(year), max(year) + 1, 5.0))
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句