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

Don't use ImageGrid in demo_text_rotation_mode. #15281

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 17, 2019

The example can be written without involving axes_grid.

old: https://matplotlib.org/gallery/text_labels_and_annotations/demo_text_rotation_mode.html#sphx-glr-gallery-text-labels-and-annotations-demo-text-rotation-mode-py
new:
new
(admittedly the inability to set the absolute spacing between subplots is mildly annoying)

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

share_all=True, aspect=True, cbar_mode=None)
axs = np.empty((len(va_list), len(ha_list)), object)
gs = subplot_location.subgridspec(*axs.shape)
axs[0, 0] = fig.add_subplot(gs[0, 0])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part would be slightly easier with something like #14421 available.

@ImportanceOfBeingErnest
Copy link
Member

I don't like that the orange boxes now touch the vertical spines.
The spacing between axes could be made smaller.

In general the old example was very good (it got improved a lot not too long ago already). If it is more complicated to not use ImageGrid, I think one could just stay with it.

@anntzer
Copy link
Contributor Author

anntzer commented Sep 17, 2019

hspace=wspace=0 gives
new

I don't mind waiting for the discussion on #14421 to be resolved first.

@timhoffm
Copy link
Member

What's the motivation for the change? I don't see that either one is particularly be better than the other.

@anntzer
Copy link
Contributor Author

anntzer commented Sep 19, 2019

I think gridspecs are nicer to use -- even though ImageGrid does allow for more accurate positioning, you need to use mpl_toolkits-specific APIs for e.g. labels and ticks (https://github.com/matplotlib/matplotlib/pull/15281/files#diff-90eb9024490f32de5d0796d7456283f0L35, https://github.com/matplotlib/matplotlib/pull/15281/files#diff-90eb9024490f32de5d0796d7456283f0L51) which is a bit awkward.

@jklymak
Copy link
Member

jklymak commented Sep 19, 2019

I agree w/ @anntzer. I think, when possible, we should make examples use the core library, not things from mpl_toolkits. If thats not possible, I think we should work on making it possible.

@jklymak
Copy link
Member

jklymak commented Apr 23, 2021

If you rebase, please ping me for a review. I think we should change this.

@jklymak jklymak marked this pull request as draft April 23, 2021 14:48
The example can be written without involving axes_grid.
@anntzer
Copy link
Contributor Author

anntzer commented Apr 23, 2021

rebased

@jklymak jklymak self-assigned this Apr 23, 2021
@timhoffm
Copy link
Member

timhoffm commented Apr 23, 2021

Not a prerequisite for merging, but would "compressed-layout" #20016 help with the spacing?

@anntzer
Copy link
Contributor Author

anntzer commented Apr 23, 2021

possibly?

@anntzer anntzer marked this pull request as ready for review April 23, 2021 22:46
@timhoffm timhoffm added this to the v3.5.0 milestone Apr 23, 2021
@timhoffm timhoffm merged commit 5e3a0f3 into matplotlib:master Apr 23, 2021
@anntzer anntzer deleted the demo_text_rotation_mode branch April 23, 2021 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants