【发布时间】:2016-05-26 22:20:52
【问题描述】:
我正在 seaborn 中绘制以下热图。数据帧是从下面读取的。 csv 文件:https://www.dropbox.com/s/mb3wc8mmis0m7g6/df_trans.csv?dl=0
ax = sns.heatmap(df, linewidths=.1, linecolor='gray', cmap=sns.cubehelix_palette(light=1, as_cmap=True))
locs, labels = plt.xticks()
plt.setp(labels, rotation=0)
locs, labels = plt.yticks()
plt.setp(labels, rotation=0)
如何修改颜色条编号,使它们 160000 显示为 1.6,颜色条顶部为 10^5。我知道在 matplotlib 中这样做很热,但在 seaborn 中却不行:
import matplotlib.ticker as tkr
formatter = tkr.ScalarFormatter(useMathText=True)
formatter.set_scientific(True)
ax.yaxis.set_major_formatter(formatter)
【问题讨论】:
-
什么是
tkr?制作一个 MCVE 会更有帮助。 -
感谢@mwaskom 提供了一个很棒的库,
tkr是import matplotlib.ticker as tkr。添加用于构建此图的数据框
标签: python pandas matplotlib seaborn