Python bar3d-如何更改tick_label_format?

时间:2014-03-30 20:39:50

标签: python matplotlib

ax.ticklabel_format(轴=' z',风格=' sci',scilimits =( - 2,2))

给出错误: AttributeError:此方法仅适用于ScalarFormatter。

1 个答案:

答案 0 :(得分:0)

This works for me:

from matplotlib import ticker

formatter = ticker.ScalarFormatter(useMathText=True)
formatter.set_scientific(True) 
formatter.set_powerlimits((-2,2))

ax.w_xaxis.set_ticklabels(column_names)
ax.w_yaxis.set_ticklabels(row_names)
ax.w_zaxis.set_major_formatter(formatter)