python - matplotlib 堆积条形图在版本更新后被窃听
问题描述
使用以下代码:
for index,axis in enumerate(axes):
for counter, bar in enumerate(axis):
max_height = start_extra_heights[counter]
w, h = bar.get_width(), bar.get_height()
if 0.0 < h < need_arrow:
plt.annotate(value_format.format(h)+'%', xy=(bar.get_x(), bar.get_y()),
xytext=(bar.get_x() + 0.2, max_height + jumps[counter]), color=suit_colors_dict[index],
arrowprops=dict(arrowstyle="->"))
jumps[counter] += proportion_to_high * 1.2
elif h > 0.0:
plt.text(bar.get_x() + w / 2, bar.get_y() + h / 2, value_format.format(h)+'%', ha="center",
va="center")
# adding the number of total lines of the original pileups
for index, bar in enumerate(axes[-1]):
max_height = start_extra_heights[index]
if max_height == 0.0:
max_height = 1.3
plt.annotate(value_format.format(sum_column[index]), xy=(bar.get_x(), bar.get_y()+bar.get_height()),
xytext=(bar.get_x(), max_height + jumps[index]),
arrowprops=dict(arrowstyle='fancy'))
return plt, axes
在不同的python环境(conda)上,我正在执行命令(来自执行图表脚本的不同用户)
pip install matplotlib –user
从那时起,绘图并不总是被创建(tiff 文件未创建或创建但为空),如果这样做,颜色将被合并(例如,参见“rep”列的橙色和粉红色)并且文本相互重叠(如“norep”列,棕色和紫色):
我尝试从同一用户卸载 matplotlib 包并重新安装我认为以前存在的不同版本,但错误的图表仍然存在。
任何想法如何解决这一问题?
解决方案
推荐阅读
- visual-studio-code - 如何在旧版本的 vscode 中测试 vscode 扩展
- python-3.x - 如何获取 LIDAR 块的唯一“点源 ID”?
- c# - 在一个单元格中绘制两个矩形的两行。可以做到吗?
- javascript - TypeError: Router.use() 需要一个中间件函数,但得到一个对象 nodejs
- kubernetes - Istio:ACME 挑战的入口不起作用 (503)
- c# - 在 Asp.Net Core 应用程序的单例中使用 Scoped 服务
- python - sympy 中(线性位移)二阶项的系数
- c# - 如何使用异步等待延迟加载集合?
- python - 如何在 EGARCH 模型中解决除以零的问题?
- django - 尝试获取字段值时出现 AttributeError