| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
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. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
@jklymak Why is it confusing? Some methods will just overwrite it. The "problem" already exist for example for axes.grid @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 😆 |
Sorry, something went wrong.
|
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 box_aspect recently proposed in #14917. |
Sorry, something went wrong.
Ha, perfect. Maybe add that as an option to rcParams then? |
Sorry, something went wrong.
|
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 adjustable parameter would need to be sorted before the axes is drawn... so I'd say let's save this for a later time. |
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
|
I mean that works, if I go for the fig, ax, = custom_wrapper() way, but it's still more complexity than what I was going for with this. |
Sorry, something went wrong.
|
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 constrained_layout should make all the subplots the same size. It will not resize the colorbar to match the parent if the parent shrinks due to aspect ratio. Thats a non-trivial problem for the way matplotlib is setup to handle layout. I'd suggest colorbars that don't take up the whole axes (using shrink=0.6 or some such). Or you can look at https://matplotlib.org/3.1.1/tutorials/toolkits/axes_grid.html and see if that works for your use case. 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. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Add axes.aspect as an option to rcParams
PR Checklist