Skip to content

Fix and clean up Skew-T example #7479

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 7 commits into from
Nov 21, 2016
Merged

Conversation

dopplershift
Copy link
Contributor

The main purpose is to address the gridline initial draw issue in #6873--which is achieved by refactoring and not doing some horrible things with mutable state. (Setting state directly was faster, but who cares about a 250x slowdown when the attribute access time is measured in microseconds either way?)

While I'm at it, I've updated for 2.x: improved the colors and addressed potential problems with minor log ticks showing up. I also updated the skew test to match the example's new design.

For some reason, `_adjust_location()` on the `SkewSpine` was not
being called; this resulted in `SkewXAxis` having the default (and out
of date) bounds for the upper x-axis. Not sure what the root cause is,
but refactoring this so that it isn't relying on the Spine to modify
attributes on the XAxis both fixes the problem and cleans up the design
greatly.
With 2.0, we now get minor ticks on log plots that don't span a full
decade (like this one if we go 1000 to 100). Just turn them off.
Grab some other colors out of the default cycle so that temp is red,
dewpoint is green, and the slanted line is blue.
Make it match the refactoring on the example.
@dopplershift dopplershift added this to the 2.0 (style change major release) milestone Nov 17, 2016
@dopplershift
Copy link
Contributor Author

I think I have a few more things to do here...

dopplershift added a commit to dopplershift/MetPy that referenced this pull request Nov 18, 2016
Matches the work done in matplotlib/matplotlib#7479, which fixes missing
gridlines identified in matplotlib/matplotlib#6873. This is a cleaner
implementation of how this is handled anyways.
dopplershift added a commit to dopplershift/MetPy that referenced this pull request Nov 18, 2016
Matches the work done in matplotlib/matplotlib#7479, which fixes missing
gridlines identified in matplotlib/matplotlib#6873. This is a cleaner
implementation of how this is handled anyways.
Refactor so that ticks, labels, and gridlines are controlled using their
flags, compensating for data ranges, rather than a hard-coded check in
the draw method. This fixes figures with a bunch of whitespace when
using bbox_inches='tight'. Also add this refactor to the test.
@dopplershift
Copy link
Contributor Author

Ok, should be good now.

dopplershift added a commit to Unidata/MetPy that referenced this pull request Nov 18, 2016
Matches the work done in matplotlib/matplotlib#7479, which fixes missing
gridlines identified in matplotlib/matplotlib#6873. This is a cleaner
implementation of how this is handled anyways.
Such an implementation already exists for update_position(), add some
for these methods for clarity and to help users who want to be able to
follow them from where they're called (like in an IDE).
Previous fixes broke upper ticks so that they never showed up. This
comes from checking the default position, 0, against the upper range.
Instead, use a sentinel of None for the default position. If a tick has
the default position, avoid checking against the interval.
@dopplershift
Copy link
Contributor Author

Ok, this latest change should fix the test--it turns out I had broken upper tick marks.

I had to add an implementation of update_position() to ensure that the new location value is set on the tick before doing a bunch of state updates. Another option would be to modify the implementations of update_position() on XTick and YTick to set the new value at the very start of the function. Personally, I think it makes more sense to do that--but I'm also not sure it's good for this implementation to rely on such a small implementation detail. Anyone have any thoughts?

@tacaswell
Copy link
Member

Why don't we ship those tick classes as part of the library (or farm them out into a installable package)?

@dopplershift
Copy link
Contributor Author

I maintain copies of this over in Unidata/MetPy--I'm not sure they're general enough to warrant a smaller package. IMO, they're here as an example of what you can really dig into with custom Axes, etc.

@efiring efiring merged commit 59a4077 into matplotlib:v2.x Nov 21, 2016
@dopplershift dopplershift deleted the fix-skew branch November 21, 2016 20:19
@efiring
Copy link
Member

efiring commented Nov 21, 2016

I have merged this because it fixes problems and seems unlikely to create any new ones; any refactoring, splitting functionality out, generalizing it, etc. can be left for the next release.

@dopplershift
Copy link
Contributor Author

dopplershift commented Nov 21, 2016

As far as making something standardized goes, I'd like to see what we can do to solve this problem in a general sense; most of the code in SkewT for the spines, ticks, etc. only exists to handle the fact that the data range for this transform is no longer a box.

ShawnMurd pushed a commit to ShawnMurd/MetPy that referenced this pull request Dec 1, 2016
Matches the work done in matplotlib/matplotlib#7479, which fixes missing
gridlines identified in matplotlib/matplotlib#6873. This is a cleaner
implementation of how this is handled anyways.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants