我需要在直方图中绘制3个值。其中一个值与其他值相比非常大。当我试图绘制它们时,由于该值过大,另外两个值在图表中无法显示。除了Python中的直方图之外,有没有其他方法在图表中说明它们?是否有缩放技巧来解决此问题?
下面给出的代码是我尝试过的。我使用了Python库numpy和matplotlib来绘制图表。
import numpy as np
import matplotlib.pyplot as plt
height = [0.422602, 0.000011, 0.000453]
bars = ('2X2', '4X4', '8X8')
y_pos = np.arange(len(bars))
plt.bar(y_pos, height, color = (0.572549,0.2862,0.0,1))
plt.xlabel('Matrix Dimensions')
plt.ylabel('Fidelity for Matrices with Sparsity 1')
plt.xticks(y_pos, bars)
plt.show()
上面的图片是输出结果,但它没有显示另外两列的值。我该如何解决这个问题呢?
注:Original Answer 翻译成“最初的回答”