-
Notifications
You must be signed in to change notification settings - Fork 283
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
deprecate ImagePlotContainer.set_cbar_minorticks #2444
deprecate ImagePlotContainer.set_cbar_minorticks #2444
Conversation
THANK YOU for doing this. I think this is a fine change to make. |
Also, I find it weird that it only works with |
Wait, I can actually NEVER make it do what it's supposed to do. Maybe it's a subtle mpl backend bug or something but now I'm worried this method may actually be plain broken. |
155d53a
to
90038b0
Compare
@yt-fido test this please |
Hm based on the warnings I'm not sure it's from the changes in 2448, but I'll try to come up with a fix! Other PRs have passed with this warning, so travis might just be acting a little weird too. All of the tests are passing, so with enough reviews this should be mergeable even with that pending icon. |
ok #2451 fixes the config warnings. |
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 really like the idea of ensuring our colorbar functions are all consistently named. Thanks for updating this function!
I have a few comments:
- I do think the API should stay the same between the two functions. We also have a
set_minorticks()
method that uses the on and off strings, and it makes sense that these two functions should have the same functionality from a user's perspective. If you do want to change this function's API (to match theset_log()
method and other methods), then the other one (and its docs) should be updated at the same time for consistency. - Would you mind updating the documentation to use the new function
doc/source/visualizing/plots.rst
for the reference documentation on its usage)? That way users won't look at the docs and try to use the deprecated function.
---------- | ||
field : string | ||
the field to remove colorbar minorticks | ||
state : bool |
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.
Is there a reason you changed the API here from a string to a bool? I suspect a new user to yt would probably find it more intuitive to write 'on' or 'off' as an arg to set_colorbar_minorticks().
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 think it would be ok to use the bool here as long as set_minorticks
is also updated to be consistent.
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 believe that most yt newcomers are at least familiar with matplotlib, which has a lot of such set_<stuff>
methods and function arguments using plain boolean to decide whether a specific plot element should be visible or not, so I think it's a good opportunity to change the api to this behaviour.
I don't know which one of us has the most realistic idea of what feels intuitive to a new user, though I agree that the change should be consistently deployed to other methods.
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 don't know which one of us has the most realistic idea of what feels intuitive to a new user
I don't really know how to feel about this, but I think both of us are trying to support our users in good faith.
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.
OK, so I have to say, this is a fascinating discussion, especially when we look at the history of PlotWindow
and the like. In some ways, what we've done is provide a big wrapper around a ton of matplotlib functionality to support a use case that I think is reasonably not-extensive, which is the idea that you have multiple fields in a single PlotWindow
and you apply the same annotations, callbacks, etc, to all of them. But I think for the most part, people don't do that!
So we're in a weird place where so much of what we've done has been to support a use case that we don't really focus on much in the docs, even, and that includes a fair bit of wrapping of functionality. This isn't bad, and it does provide some nice ways to set defaults, but it's a layer between us and matplotlib.
Anyway, I think we should evaluate this, but I do think that any major API changes need to wait for 4.0, which shouldn't actually be too much longer to be master
.
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.
To add to this, I personally have mixed feelings about this use case. At the same time, it makes the simple, most repeated task extremely easy to perform, which is precisely what drove me into yt in the first place, but it also makes more refined plots somewhat harder to produce when one means to "talk to matplotlib" trough yt.
Anyway, I'm absolutely fine with delaying these changes to yt-4.0 if you think it's appropriate. However, I'm not sure I'm reading your statement right. Do you consider this a major change ? I guess not, but I'll admit I'm unsure.
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 suspect these changes are not major API changes and can be merged before yt-4.0 (though Matt can also weigh in here if I've misinterpreted things). I think this is especially true because you've kept the old functions and have some depreciation warnings when they're called. You've certainly added to the usability of yt and I think this is a helpful contribution. 🙂
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 agree!
Alright it should be more consistent now, though I think you referred twice the same documentation file by mistake, so there's must be another that need to be adressed. Also, while browsing documentation I noticed to other methods using "cmap" in there names, so I'm going to deprecate them as well. |
The one method I'm not willing to touch is |
…hods naming convention ('cbar' -> 'colorbar')
0ee3910
to
20e60af
Compare
Ok I edited the comment to be a little bit clearer. What I meant was that you should update the references with |
Thanks for clarifying this. Indeed I missed some references in the .rst doc file. Should be fixed now ! |
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.
Ok, I've looked over your most recent changes and left a few comments.
More generally, I think you should add a issue_deprecation_warning()
for the deprecated functions. This function should be user-visible and is adapted from numpy.
---------- | ||
field : string | ||
the field to remove colorbar minorticks | ||
state : bool |
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 don't know which one of us has the most realistic idea of what feels intuitive to a new user
I don't really know how to feel about this, but I think both of us are trying to support our users in good faith.
… with new ones in the docs
Thanks for pointing out this function, I didn't know we had one ! I think I've addressed your concerns now :) |
@yt-fido test this please |
The idea here is to uniformise the existing Colorbar api by using a single naming convention ('cbar' -> 'colorbar')
Considering the existing methods
I propose to just use "colorbar" everywhere with one change.
I'm keeping the old method for backwards compatibility but I also set a deprecation warning. I don't think this is common practice around here so it's unclear when the "deprecated" method should be removed (I'd suggest yt 4.0 to make it cleaner, but since I'm not sure we'll get a release before this one, it may be a bit of a rush).