Frage

Ich mag gekrümmt Grundstück / gebogene Linien auf einer Basiskarte Karte. Ich kann eine gerade Linie zeichnen map.plot mit (x, y, ..), aber wie kann ich es machen gebogen / haben Pfeile?

In matplotlib, kann dies geschehen mit annotate (..), aber Basemap diese Methode nicht hat.

Irgendwelche Ideen?

War es hilfreich?

Lösung

This is a very old question, but I thought it might be good to answer anyway. When you said curved lines, I assumed you meant drawing a great circle. There is an example of doing exactly that in the basemap documentation, which I have modified to make a little more easy to modify yourself:

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

Note that the great circle method cannot handle the crossing of the edges of the map (as mentioned in the documentation), which, although clearly documented, is a pretty major flaw IMHO.

Hope that helps somebody,

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top