Unidata / MetPy

MetPy is a collection of tools in Python for reading, visualizing and performing calculations with weather data.
https://unidata.github.io/MetPy/
BSD 3-Clause "New" or "Revised" License
1.26k stars 415 forks source link

Adding annotated data value points to gridded plot #1535

Open grwise1 opened 4 years ago

grwise1 commented 4 years ago

First, I apologize if this feature is already buried somewhere. I have searched extensively through Metpy and matplotlib documentation.

I am plotting gridded data via pcolormesh. I would like to add annotated temperature readouts at a set density throughout the 2D plot. Displaying a data point at (x,y) with the associated "z" value annotation. Density could be controlled similar to how ax.quiver works. Is there a method for this? The only option I have found suggested is looping through the matplotlib ax.annotate?

Let me know if I can clarify this in a better way. Thanks for the help.

dopplershift commented 4 years ago

There's no built-in plotting function for this, but you can get what you generally describe by using StationPlot with the plot_parameter() method, using reduce_point_density to cut down your points. I am curious what the results of using reduce_point_density on a grid will be. This example should hopefully point you in the right direction, but let us know if it doesn't get you there.