我使用matplotlib创建了几个图表。 X轴始终包含时间,Y轴包含给定值。
图表创建如下:
fig = plt.figure(1)
ax = fig.add_subplot(111)
ax.set_title('Experience Graph')
ax.set_xlabel('Time')
ax.set_ylabel('Experience')
ax.plot(self.timeStorage, teamTotalXP)
ax.fill_between(self.timeStorage,0, teamTotalXP, alpha=0.5)
...
plt.xticks(rotation=20)
plt.savefig(directory + "teams_experience.svg")
plt.clf()
创建时间存储如下:
timeStorage.append(datetime.datetime.utcfromtimestamp(replay.info.game_time))
我在两个不同的Ubuntu实现上试过这个:
Ubuntu 1:
Ubuntu 2:
可以看出我的第二个版本就像秒钟一样烦人浮动。
额外信息:
因此我想知道是否有人知道如何解决我的问题,或者降级是唯一的解决方案。
提前致谢,
Giriel
答案 0 :(得分:0)
解决方案是使用DateFormatter。 奇怪的是我之前没有这么做过。
查看此答案以获取更多信息: How to change date format using matplolib in python