【问题标题】:How can I determine the scale range in y axis in Seaborn Line Graph如何确定 Seaborn 线图中 y 轴的比例范围
【发布时间】:2020-03-17 09:29:47
【问题描述】:

我想在 seaborn 图中排列 y 轴的值。 我想以这种顺序增加数字 -> 100,1000,10000

我该怎么做。

我可以使用下面定义的这个 seaborn 图形代码。

ax = sns.lineplot

【问题讨论】:

标签: python pandas seaborn


【解决方案1】:

您可以使用 ax.set_yticks 并传递要在 y 轴上设置的代码值列表(以及 ax.set_xticks 用于 x 轴)

ax = sns.lineplot(x, y);
ax.set_yticks([100,1000,10000])

当然,您可以使用列表理解生成列表

yticks = [10**i for i in range(2, 5)]
ax.set_yticks(yticks)

或者,您也可以使用ax.set_ylim,它接受一个开始和结束值。 ax.set_ylim(100, 1000),但我认为您不能在此函数中指定增量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-04
    • 2023-03-10
    相关资源
    最近更新 更多