【发布时间】:2015-07-16 22:05:13
【问题描述】:
我开始使用 seaborn,我只使用 pyplot.plot 函数,每当我使用对数刻度时,轴刻度都会显示为 10 的幂。在使用 seaborn 之前,行
ax.xaxis.set_major_formatter(FormatStrFormatter('%.0f'))
正在解决问题,但现在使用 seaborn 并没有。有什么想法可以在我的轴上使用简单的符号吗?
以下是代码示例。我希望 x 轴的形式为: 0.1, 1, 10 , 100 .. 而不是现在这样。
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('ticks', {'font.family': 'sans-serif'})
sns.set_context("paper", font_scale=1.3)
plt.rc('text', usetex=True)
x_lim=[0.1,100]
y_lim=[1.2001, 2.2001]
f = plt.figure()
plt.xscale('log')
plt.ylim(y_lim)
plt.xlim(x_lim)
plt.hlines(1.5, *x_lim, color='grey')
plt.show()
【问题讨论】:
-
我无法重现此行为。您能否提供一个导致您看到的问题的完整可重现示例?
-
我用一些代码编辑了帖子,我无法附上图片,但你可以find it here。
标签: python matplotlib seaborn