Plotting a Curve Curve in a Python Database

I would like to draw curves / arc lines on a Basemap map. I can build a straight line using map.plot (x, y, ..), but how to make it curved / have arrows?

In matplotlib, this can be done using annotations (..), but Basemap does not have this method.

Any ideas?

+4
source share
1 answer

This is a very old question, but I thought it would be nice to answer anyway. When you made the curved lines, I assumed that you wanted to draw a great circle . Here is an example of what the basic documentation I modified to make the change a little easier:

from mpl_toolkits.basemap import Basemap import numpy as np import matplotlib.pyplot as plt m = Basemap(projection='cyl') p0_ll = -73.98, 40.78 p1_ll = 0.08, 51.53 m.drawgreatcircle(p0_ll[0], p0_ll[1], p1_ll[0], p1_ll[1], linewidth=2, color='b') m.drawcoastlines() m.fillcontinents() plt.show() 

enter image description here

Please note that the large circle method cannot handle the intersection of map edges ( as indicated in the documentation ), which, although clearly documented, is a rather serious drawback of IMHO.

Hope someone helps,

+3
source

Source: https://habr.com/ru/post/1332228/


All Articles