-
Notifications
You must be signed in to change notification settings - Fork 445
Declarative/simplified plotting #989
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
Conversation
6e07b54 to
da7ba5d
Compare
jrleeman
left a comment
There was a problem hiding this 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
examples/plots/Combined_plotting.py
Outdated
| # Plot the data on a map | ||
| panel = MapPanel() | ||
| panel.area = 'us' | ||
| panel.maps = ['coastline', 'borders', 'states', 'rivers', 'ocean', 'land'] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. | |||
There was a problem hiding this comment.
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.
metpy/plots/declarative.py
Outdated
|
|
||
| _projections = {'lcc': ccrs.LambertConformal(central_latitude=40, central_longitude=-100, | ||
| standard_parallels=[30, 60]), | ||
| 'ps': ccrs.NorthPolarStereo(central_longitude=-100), 'mer': ccrs.Mercator()} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
metpy/plots/declarative.py
Outdated
| return self.projection | ||
|
|
||
| @property | ||
| def _map_features(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again - layers here maybe?
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, _): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
56e0754 to
5aef138
Compare
Adds a declarative interface for creating plots, similar in nature to GEMPAK.
a96e851 to
c370683
Compare
c370683 to
e16c0b5
Compare
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: