我必须绘制大量数据(300-1500行),我将数据分成350行。我希望左y轴与第一个数据点在08:05:11之间的距离为零(或较小)。我尝试了很多,但不知道了。我认为这与真正的大无花果有关(有时我需要300,6)
请帮助
fig, host = plt.subplots(figsize=(70,6))
par1 = host.twinx()
host.grid(True)
host.plot(t1, s1, "bo", label="Status")
par1.plot(t1, e1, "r--", label="Event")
host.tick_params(axis='y', colors="blue")
host.set_ylim(3,-1)
host.set_ylabel("Status",fontsize=15,color="blue",)
host.tick_params(axis='x', colors="black",rotation=90)
host.set_xlabel("Timestamp: " + day,fontsize=15)
host.tick_params(axis='y', colors="blue",labelsize=20)
host.set_yticklabels(("Running", 'Unused', 'Problem'))
par1.set_ylim(2,-1)
par1.tick_params(axis='y', colors="red")
par1.yaxis.tick_left()
fig.tight_layout()
legend = host.legend(loc='upper left',bbox_to_anchor=(0.05, 1.00), shadow=True, fontsize='x-large')
legend2 = par1.legend(loc='upper left',bbox_to_anchor=(0.08, 1.00), shadow=True, fontsize='x-large')
legend.get_frame().set_facecolor('#c4c6c7')
legend2.get_frame().set_facecolor("#c4c6c7")
答案 0 :(得分:0)
修复了我只需要设置xlim的问题,那比它非常合适