我做了一個水平條形圖,現在我需要在條上添加標記。我該怎麼做?如何在Python中的條形圖上添加標記?
代碼我迄今如下:
def plot_comparison():
lengths = [11380, 44547, 166616, 184373, 193068, 258004, 369582, 462795, 503099, 581158, 660724, 671812, 918449]
y_pos = np.arange(len(length))
error = np.random.rand(len(length))
plt.barh(y_pos, length, xerr=error, align='center', alpha=0.4)
plt.yticks(y_pos, length)
plt.xlabel('Lengths')
plt.title('Comparison of different cuts')
plt.show()
的可能的複製[matplotlib:設置標記單個點上線(http://stackoverflow.com/questions/8409095/matplotlib-set-markers-for-individual-points在線) –
在這種情況下,我需要在條形圖上放置標記。 – Sanchit795
我相信標記僅適用於內襯圖形 –