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.25k stars 414 forks source link

Add quiver functionality to hodograph #806

Closed jrleeman closed 6 years ago

jrleeman commented 6 years ago

It would be nice to be able to easily add vector arrows to a hodograph (probably mostly for educational purposes). hodograph-noaa

eliteuser26 commented 6 years ago

I have created an example which displays the lines from 0,0 to the points on the hodograph as shown in the picture above. I will submit a PR for it very soon. The thing I am not sure about is how to make arrows at the end of the line. Any suggestions?

I could probably suggest a quiver keyword which is false by default. By setting the quiver parameter to True it would draw the lines. Would that be a good solution for your code?

jrleeman commented 6 years ago

No, I think we'd want it as a method on the hodograph class. @dopplershift probably has an opinion here as well.

Here's a good resource for drawing arrows: https://matplotlib.org/examples/pylab_examples/arrow_simple_demo.html

eliteuser26 commented 6 years ago

That would have been my second option as well. That is why I ask the question. I want to understand how the Metpy code is built in general. I have created an example out of the Metpy code to see if it works.

The final plot looks very good without the arrows for now. If you have a better solution, I am open to suggestions.

Here is a plot example with the quiver lines.

hodograph_example

eliteuser26 commented 6 years ago

By looking at the arrow example this will change and simplify my code even more. I should have went with my first solution which I didn't pick. Oh well back to the drawing board.

eliteuser26 commented 6 years ago

Here is the representation from NOAA without the arrows for now.

hodograph_example2

jrleeman commented 6 years ago

FYI, I'm planning on putting in a PR for this that makes it live in the Hodograph class and will make your example much shorter. (If an issue shows an assignee like this one does, it generally means there is already work taking place.)

eliteuser26 commented 6 years ago

Sorry about that. I usually looked at the assignee before I start but I didn't look this time around. I thought it would have been a good exercise for me as it is easy one to work on. I also look at the PR as well.