Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control max number of ticks #20

Open
lbdreyer opened this issue Jul 19, 2016 · 2 comments · May be fixed by #126
Open

Control max number of ticks #20

lbdreyer opened this issue Jul 19, 2016 · 2 comments · May be fixed by #126

Comments

@lbdreyer
Copy link
Member

Currently, the max number of ticks is set to 4 (on this line). This is a bit restrictive.

It would be nice if the user had control over the number of ticks, perhaps through the use of some kind of set_max_ticks method.

@sjsmith757
Copy link

I think this would be relatively easy to implement. I'm experienced with python but not with GitHub so I've been toying around with how to contribute a solution to this. In the mean time, if anyone else wants a work around for modifying the number of ticks, here's an example which sets the max number to 7. You can also modify other parameters of matplotlib's MaxNLocator this way.

ax.xaxis.get_major_locator()._max_n_locator.set_params(nbins=7)

Note this only works if the resolution is not daily. If you have daily resolution along the time axis, use

ax.xaxis.get_major_locator()._max_n_locator_days.set_params(nbins=7)

Really it would be great if support is implemented for the set_params() method. This information could be passed onto the MaxNLocator as I am doing here. Then you could make your adjustments using the ax.locator_params from matplotlib. I'm working on such a solution but do not have much time to dedicate, and so I'm leaving this idea here to help collective progress.

@pp-mo
Copy link
Member

pp-mo commented Mar 29, 2023

@SciTools/peloton just reviewing this.
@sjsmith757 is there any chance of your submitting an attempt at this ?
Otherwise we might have to close this down.

@sjsmith757 sjsmith757 linked a pull request Apr 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants