-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add axes.aspect
as an option to rcParams
#15001
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
Conversation
Thanks for the PR but I’m against this as an rcParam. It will lead to lots of confusion particularly as we have some plotting methods that set the aspect ratio. |
I don't think it is that confusing. Plotting methods take precedence over rcParams (One could also name it "default aspect" to make this more apparent.) My problem with this is of a different nature. Since aspect is depending on the data to be plotted, how can you know the aspect prior to knowing what data to plot? Styles should be generally applicable, so I do wonder about a real world use case for this. I.e. when would you say "Oh, let's take the style that sets the aspect to 5."? Maybe there is such usecase, but I can't really think of one at the moment. |
The confusion I was referring to was more that someone will forget they set this to equal and wonder why their axes was shrunk to zero height because their data aspect was 1:100000 |
Well, sure, but that applies to almost any other parameter as well. You could also forget that you set the linewith to 0 and wonder why no data is shown etc. |
@jklymak Why is it confusing? Some methods will just overwrite it. The "problem" already exist for example for @ImportanceOfBeingErnest Here's my use case. I want to have a style with by default square plots. I also sometimes want a colorbar. Based on how I go about it, this will either shrink the main plot along x. Or make_axes_locatable() will shrink it proportionally. Either way I am left with a different size main plot than without the colorbar. This lets me set figsize slightly larger in x to fit the cbar without affecting the main plot. Let me know if there would be a better way. To be fair I don't think there's a use case for an aspect=5 😆 |
In that usecase, if your data is not perfectly inside the [0,1] range, the axes shape would change, right? So it looks more like it would benefit from the |
Ha, perfect. Maybe add that as an option to |
One could think about that, yes. But one would need to be careful; currently this is a parameter set a posteriori by the user only. But if it's to be set at init time of any axes, it would sure cause problems e.g. with colorbar axes and also the interplay between the |
Any suggestions what to do in the meantime to consistently produce plots with the same main axes size, with or without colorbar? My backup solution was to have some wrapper functions like https://matplotlib.org/3.1.1/gallery/axes_grid1/demo_axes_rgb.html |
Without having thought about it in depth... can you just always put a colorbar in and make it invisible in cases you don't need one? |
I mean that works, if I go for the |
Yeah, but adding a rcParam, which has far-reaching implications, for a particular annoyance is not the way to go, in my opinion. I'm not sure how you are laying out your plot, but I'm going to close this, but if you want to open an issue with a runnable example of your code, we can try to help even if it turns into a feature request. |
PR Summary
Add
axes.aspect
as an option torcParams
PR Checklist