简体   繁体   中英

How can I determine the scale range in y axis in Seaborn Line Graph

I want to arrange the values of y-axis in seaborn graph. I want to increase number in such kind of order -> 100,1000,10000

How can I do that.

I can use this seaborn graph code defined below.

ax = sns.lineplot

You can use ax.set_yticks and pass a list of ticker values you want to set on y axis (and ax.set_xticks for x axis)

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

And of course you can generate your list using list comprehension

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

Alternately, you can also use ax.set_ylim which takes a start and end value. ax.set_ylim(100, 1000) , but I don't think you can specify the increment in this function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM