Plotting a circle in leaflet using .add_artist()

半世苍凉 提交于 2019-12-23 04:00:23

问题


Starting from here and the first example from here, I'm trying to use pyplot and mplleaflet to plot a fixed-size circle on a map.

(By "fixed-size", I mean that this circle is not a marker, it shouldn't adapt to the zoom level, but should stay of, say, 25m diameter whatever the zoom level).

Here is what I got :

import mplleaflet
import matplotlib.pyplot as plt
import matplotlib as mpl

fig, ax = plt.subplots()
x = 2.363561
y = 48.951918
r = 20
circle1 = mpl.patches.Circle((x,y), radius=r)
circle2= plt.Circle((x, y), r, color='r')

ax.add_artist(circle1)
ax.add_artist(circle2)

mplleaflet.show(fig=ax.figure)

Code runs fine, but when the new leaflet tab opens, I got nothing :

来源:https://stackoverflow.com/questions/46305778/plotting-a-circle-in-leaflet-using-add-artist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!