import matplotlib.pyplot as plt
objects = ('A', 'B', 'C')
avgA, avgB, avgC = 0.009990256984352774, 0.0014206548643907065, 0.055161861569464204
performance = [avgA, avgB, avgC]
exact = plt.plot(performance, alpha=0.5, color= 'purple')
plt.xlabel('Compression Method')
plt.ylabel('Average Distance b/w Uncompressed & Compressed Point')
plt.title('Evaluation of Different Compression Methods - Averages')
plt.tight_layout()
plt.show()
我的图表有3个问题:
要设置xtick,最好只调用
plot
,将objects
作为其第一个参数。要设置更多的y记号,MultipleLocator
可以用来指示主记号和次记号之间的距离(主记号显示一个数字)要向绘图添加文本,只需调用
plt.annotate('text', xy=(x,y))
,其中x是0、1、2,因为x只是标签。y是通常的y值。 您可以添加许多选项来定位文本,有无箭头、对齐等。请参见documentation相关问题 更多 >
编程相关推荐