All plot_
functions in StationPlot
should return the collection
#3472
Labels
Type: Feature
New functionality
What should we add?
Among the plot functions of the
StationPlot
module, only some of them return the object containing the collection drawn on the plot. For example,plot_text
returnsMetPy/src/metpy/plots/station_plot.py
Line 246 in 238d66d
This is useful, because in case one wants to reuse the same axis/figure for an animation, it is sufficient to just remove the collection and draw again on the same axis. However, some functions (like
plot_barb
) do not return these objects. Still, this is easy to implement by just adding, e.g.after this line
MetPy/src/metpy/plots/station_plot.py
Line 289 in 238d66d
For sure there is a cleaner way to do this, but still this is how I just implemented it on my side (and it works). Having all the functions return the collection drawn on the plot would be also more consistent than having just some of them doing so.
Just for reference here is the code that is handling the animation
For this to work,
stationplot.plot_barb
needs to return thebarbs
collection.Reference
No response
The text was updated successfully, but these errors were encountered: