【问题标题】:How to prevent scientific notation in matplotlib boxplot (when ScalarFormatter is not used)? [duplicate]如何防止 matplotlib boxplot 中的科学记数法(不使用 ScalarFormatter 时)? [复制]
【发布时间】:2020-03-06 04:55:24
【问题描述】:
boxplot(df.dmass)
ylabel(r'$\Delta M$')
xlabel('peakMz - exactmass')

这些值都在 -1 左右,但你无法从那个不幸的符号中猜到。

gca().ticklabel_format(useOffset=False) 在这里不起作用。

【问题讨论】:

  • “不起作用”从来都不是一个有用的问题描述。使用时会发生什么?
  • AttributeError: 此方法仅适用于 ScalarFormatter
  • 哦,是的,因为 xaxis 不使用 ScalarFormatter。所以你只需要为我想的 y 轴做这件事,gca().ticklabel_format(axis="y", useOffset=False)
  • 不确定你的意思。如果这是您想要的,您可以全局关闭偏移量?
  • 那太好了!

标签: matplotlib


【解决方案1】:

因此,根据ImportanceOfBeingErnest 需要禁用轴特定的偏移量:

gca().ticklabel_format(axis="y", useOffset=False) 

对于 y 轴。

【讨论】:

    猜你喜欢
    • 2016-02-21
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 1970-01-01
    • 2022-10-10
    • 2018-03-25
    • 2022-01-19
    相关资源
    最近更新 更多