为什么注释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