我是 Bokeh 的新手,目前正在尝试将直方图的 x 轴从基于十进制更改为基于百分比。我一直在尝试使用,PrintfTickFormatter但我显然错过了一些东西。当我尝试以下两行代码时,我没有收到任何输出。我尝试调整格式声明,我确实达到了一个百分比,但它将小数转换为 < 1% 或四舍五入为 1%。关于如何修复的任何想法?我在 SO 上看到了一些不同的帖子,但似乎没有一个直接适用
fig.xaxis.formatter = PrintfTickFormatter(format='0 %')
Run Code Online (Sandbox Code Playgroud)
我能够通过以下方式解决问题:
from bokeh.models import NumeralTickFormatter
fig.xaxis.formatter = NumeralTickFormatter(format='0 %')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2848 次 |
| 最近记录: |