Skip to content

Conversation

@dopplershift
Copy link
Member

First cut at the so-called "GEMPAK" style plotting interface. This provides a declarative interface for plotting, where the focus is on setting attributes to certain values. This also is wired to hopefully work properly with widgets in the notebook to provide a nice path to interactive, event-driven simple interfaces.

Still todo for this cut:

  • Finish up adding a list of pre-done areas for plotting
  • Tests

@dopplershift dopplershift requested a review from jrleeman as a code owner January 4, 2019 07:39
@dopplershift dopplershift added this to the 0.10 milestone Jan 4, 2019
@dopplershift dopplershift added Type: Feature New functionality Area: Plots Pertains to producing plots labels Jan 4, 2019
@dopplershift dopplershift force-pushed the declarative branch 4 times, most recently from 6e07b54 to da7ba5d Compare January 5, 2019 17:21
jrleeman
jrleeman previously approved these changes Jan 5, 2019
Copy link
Contributor

@jrleeman jrleeman left a comment

Choose a reason for hiding this comment

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

Few minor comments/suggestions

# Plot the data on a map
panel = MapPanel()
panel.area = 'us'
panel.maps = ['coastline', 'borders', 'states', 'rivers', 'ocean', 'land']
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe map layers? maps seems odd as we're making a map, and these are features/layers/things on the map.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good.

@@ -0,0 +1,31 @@
# Copyright (c) 2019 MetPy Developers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use a less generic name for this example? Simple image plot? Something that doesn't take a name with little description of the output.


_projections = {'lcc': ccrs.LambertConformal(central_latitude=40, central_longitude=-100,
standard_parallels=[30, 60]),
'ps': ccrs.NorthPolarStereo(central_longitude=-100), 'mer': ccrs.Mercator()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrap each one to a new line? Just a style comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

return self.projection

@property
def _map_features(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Again - layers here maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

internal, so less important, but with the rename of the public property, I'll make _layer_features.



@exporter.export
class ImagePlot(Plot2D):
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we have pure x/y data that we want to use with this syntax, not on a map? (similar to just wanting to make a line plot or similar. Maybe this is a image "heat map" of time series data.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not convinced this will ever be something we really want to support, but we can revisit in the future if a compelling use case appears. I don't think we're doing anything that would make it difficult to support (heck, it might actually work currently).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I may be biased, but one good use case could be cross sections! Or, would that work better as a separate class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Darn you and your good ideas @jthielen 😉

Will need to wait for next release, but that's a really good one. We'll need a new panel type for that as well.

contours = Union([List(Float()), Int()], default_value=25)

@observe('contours', 'linecolor', 'linewidth')
def _set_need_rebuild(self, _):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this different from need redraw? Don't see that getting set here anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

So the name of the method doesn't really matter as far as overriding, whatnot. I've been using "redraw" conceptually as just needing to call draw, which will redisplay with the current set of attributes. A "rebuild" means you need to re-execute the matplotlib plotting methods to replace the existing plot.

@dopplershift dopplershift force-pushed the declarative branch 6 times, most recently from a96e851 to c370683 Compare January 6, 2019 00:24
@jrleeman jrleeman merged commit cee9d4d into Unidata:master Jan 6, 2019
@dopplershift dopplershift deleted the declarative branch January 6, 2019 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Plots Pertains to producing plots Type: Feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants