Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix polar get window extent #13614

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

Merged
merged 1 commit into from
Mar 11, 2019

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Mar 7, 2019

PR Summary

This PR does 2 things. First, cleans up markerevery_demo to use modern semantics; Second, catches an error in spines.get_window_extent that can happen if the spine has no axis.

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

@jklymak jklymak added topic: geometry manager LayoutEngine, Constrained layout, Tight layout Documentation labels Mar 7, 2019
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Repeat my comments for the remaining figures.

@@ -20,6 +20,7 @@

"""

from __future__ import division
Copy link
Member

Choose a reason for hiding this comment

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

We don't need this unless you're backported to 2.2.x?

ax = []
fig1, axs = plt.subplots(rows, cols, figsize=figsize, constrained_layout=True)
axs = axs.flat
axs[-1].remove() # not used...
Copy link
Member

Choose a reason for hiding this comment

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

That depends on the length of cases, doesn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, but...

Copy link
Contributor

@anntzer anntzer Mar 7, 2019

Choose a reason for hiding this comment

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

something like for ax in axs[:len(cases)]: ax.remove() after converting to axs.flat looks better to me, perhaps have a helper function.

ax.append(fig1.add_subplot(gs[row, col]))
ax[-1].set_title('markevery=%s' % str(case))
ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
ax = axs[i]
Copy link
Member

Choose a reason for hiding this comment

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

for ax, case in zip(axs, cases): (don't think i is used for anything here now.)

fig4 = plt.figure(num=4, figsize=figsize)
axpolar = []
fig4, axs = plt.subplots(rows, cols, figsize=figsize,
subplot_kw = {'projection':'polar'}, constrained_layout=True)
Copy link
Member

Choose a reason for hiding this comment

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

Remove space around =.

@jklymak
Copy link
Member Author

jklymak commented Mar 7, 2019

Added a test that fails on master:

        bboxes = [bb]
>       tickstocheck = [self.axis.majorTicks[0]]
E       AttributeError: 'NoneType' object has no attribute 'majorTicks'

lib/matplotlib/spines.py:163: AttributeError

and passes w/ this PR....

@jklymak jklymak force-pushed the fix-polar-get-window-extent branch 3 times, most recently from 75cd5fd to bda7c19 Compare March 7, 2019 17:12
@tacaswell tacaswell added this to the v3.2.0 milestone Mar 8, 2019
@jklymak jklymak modified the milestones: v3.2.0, v3.1.0 Mar 8, 2019
@jklymak
Copy link
Member Author

jklymak commented Mar 8, 2019

@tacaswell re-milestoned, but feel free to re-milestone back. Maybe my mistake for mixing two things in the PR, but this fixes a real bug in getting the tightbbox from polar axes...

@jklymak jklymak force-pushed the fix-polar-get-window-extent branch from bda7c19 to e297810 Compare March 8, 2019 06:36
@tacaswell tacaswell merged commit 546228f into matplotlib:master Mar 11, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 11, 2019
jklymak added a commit that referenced this pull request Mar 11, 2019
…614-on-v3.1.x

Backport PR #13614 on branch v3.1.x (Fix polar get window extent)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation topic: geometry manager LayoutEngine, Constrained layout, Tight layout
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.