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
Add option to hide or show tick labels. #6018
Conversation
d1b3c38
to
247318e
Compare
The axis can be set however you like after the function is done -- right? |
I'll take this as a request to change the default then. I don't want to get into the business of providing the options that matplotlib provides. Long long ago there was a version that kept the axis ticks on by default. But we changed it to what I think might be a better default. I think that the numbers on the axes are usually irrelevant and get in the way. Perhaps we should put a note in the doc_string (or somewhere else better?) telling people how to do this? Or maybe StackOverFlow is enough? Thoughts? |
Yes, I think changing the default would be desirable. I almost always turn the ticks back on for development and only remove them for publication figures. Another argument for changing the default is that plotting currently depends on the order of execution. E.g., I might set ticks or tick labels before plotting and find that they have disappeared. In contrast, if I set the x-limits or tick labels and plot another object (e.g., using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm -1 on changing the default, and usually I'm against expanding the already bloated visualization API but I think the argument to add a kwarg to control this behavior is compelling.
The matplotlib tick_params
API is verbose enough that users are likely to have too look it up each time they want to modify it. Replacing this with a toggle makes sense. Unfortunately the toggle itself will have discoverability issues swimming in the sea of existing keyword arguments, but searching the nx_pylab
docs with a ctrl+f "tick"
is at least as discoverable as finding the tick_labels
object in the matplotlib refguide. Ultimately I'm in favor of this proposal!
247318e
to
00b9400
Compare
00b9400
to
cfc9b66
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the liberty of pushing up a bit more info in the parameter description in the docstring, but otherwise this LGTM. Thanks for the suggestion @tillahoffmann and the well-researched/tested proposal!
I can "justify" accepting this change along-side our general policy of not implementing matplotlib style features within our code kwargs as follows: This This PR allows users to turn off that style choice. So I am supportive of this PR. Thanks @rossbar for your work with this (including bringing it to the community meeting agenda). And Thanks @tillahoffmann for the PR (sorry this took so long! :) |
Thanks for merging and the thorough review! |
* Add option to hide or show tick labels. * Update parameter description in docstring. --------- Co-authored-by: Ross Barnowski <rossbar@caltech.edu>
This PR adds a flag
hide_ticks
to drawing functions so tick labels can be shown. This can be useful for debugging or spatial networks, for example. The default ishide_ticks=True
to ensure functionality does not change.Edit: I'm not sure why the Circle CI test fails.
Edit: It seemed that Circle CI was failing because I hadn't updated my default branch from
master
tomain
yet.