爲什麼註釋prettyplotlib
barchat和x軸標籤偏離中心?prettyplotlib標籤和註釋偏離中心
使用prettyplotlib==0.1.7
如果我們創建與由第二參數所限定的x軸的正常條形圖中,標籤是公中心的條上:
%matplotlib inline
import numpy as np
import prettyplotlib as ppl
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1)
counter = {1:1, 2:4, 3:9, 4:16, 5:25, 6:36, 7:49}
x, y = zip(*counter.items())
ppl.bar(ax, x , y, grid='y')
[OUT]:
但是,如果我們使用xticklabels
x軸標籤熄滅中心:
ppl.bar(ax, x , y, xticklabels=list('1234567'), grid='y')
[OUT]:
類似地,當我們使用annotate=True
參數,它進入偏心:
ppl.bar(ax, x , y, annotate=True, grid='y')
[OUT]:
它不像https://github.com/olgabot/prettyplotlib/wiki/Examples-with-code#hist上顯示的例子
謝謝@ImportanceOfBeingErnest!我已經搬到了'seaborn' +'matplotlib'。 – alvas