matplotlib - 在 y 轴上添加科学记数法会改变 matplotlib 条形图中条形的高度
问题描述
我想在 y 轴上用科学记数法制作条形图。
但是,当我使用 时
plt.ticklabel_format(axis="y", style="scientific", scilimits=(0,0), useOffset = False, useMathText=True)
,条形图的高度会发生变化,因此输入参数不正确。
我真的不知道为什么会这样。请参阅所附的两个图和代码。
fig = plt.figure()
# with and without below line
plt.ticklabel_format(
axis="y",
style="scientific",
scilimits=(0,0),
useOffset = False,
useMathText=True,
)
plt.bar(x=x, height = height)
plt.xlabel('Load case no.')
plt.ylabel('Damage [-]')
plt.grid(axis="y",linestyle='--')
plt.draw()
解决方案
推荐阅读
- codeigniter - 如何在codeigniter表单验证中使用助手的回调?
- python - 熊猫没有丢弃或填充缺失值
- python-3.x - 各种版本的二元轮有什么区别?
- audio - Concat mp4 视频并将其音频合并到最终输出
- c# - C#统一命名空间'
' 已经包含一个定义 - ios - 带有标签、图像、gif 和视频的 TableView 在从 iOS、Swift 中的 firestore 获取时挂起/卡住不正确
- r - 如何将 csv 数据加载到 r 中?特别是没有文件?
- java - 为什么 Jacoco Coverage Report for Branches 说 if (a && b && c) 实际上是 6 个分支?
- python - Django 在序列化程序中无法识别我的自定义更新方法
- sql - 如何在 DB2 中查找具有 DBCException:SQL 错误:CharConversionExcetion 的行?