python - 当我在 matplot 中绘制条形图时,如何定制 yticks` 比例?

标签 python matplotlib

enter image description here

我是 matplot 的新手。 正如您在上图中看到的,在我的图中,某些项目的值太小,以致于条形的某些部分太低(就像红色部分一样),因此这些部分不是很清楚地看到。 我该如何解决这个问题?

最佳答案

如果您使用matplotlib.pyplot.bar ,可以添加参数log。 示例:

plt.bar(df.index, df[col].values, label=label, log=True)

或者:

ax.set_yscale('log')

关于python - 当我在 matplot 中绘制条形图时,如何定制 yticks` 比例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56253677/

相关文章:

python - pylab.hist(数据,规范=1)。规范化似乎工作不正确

Python/解析 : BeautifulSoup error "module obj is not callable" with results from Mechanize

python - 如何使用 Pattern 对西类牙语单词进行词形还原?

python - 如何在Y轴不同高度上绘制列表列表?

python-2.7 - 如何从 matplotlib.pyplot 图中的 y 刻度标签中删除负号?

python - 等高线图python中的长错误

python - 使用 mplcursors 在同一图表上为多个数据集添加标签

python - 如何在 pyspark 上创建分层拆分训练、验证和测试集?

python - Python 中的多行日志记录

python - 如何在 firefox python selenium 中打开控制台?