has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4k stars 213 forks source link

How to increase the number of ticks #641

Closed Yaoyx closed 1 year ago

Yaoyx commented 1 year ago

I tried to increase the number of ticks in my plot, and I have tried all parameters of scale_x/y_continuous function, but I still cannot figure out a way to do it.

has2k1 commented 1 year ago

Use a function to calculate the breaks or set the breaks explicitly. See extended_breaks. It is the default function that computes the breaks and you can use it directly.

scale_x_continuous(breaks=extended_breaks(n=10))
scale_x_continuous(breaks=[1, 2, 3, 4, 5])
Yaoyx commented 1 year ago

Use a function to calculate the breaks or set the breaks explicitly. See extended_breaks. It is the default function that computes the breaks and you can use it directly.

scale_x_continuous(breaks=extended_breaks(n=10))
scale_x_continuous(breaks=[1, 2, 3, 4, 5])

Thank you so much for your help!