使用.add\u artist()在活页中绘制圆

2024-05-26 21:50:26 发布

您现在位置:Python中文网/ 问答频道 /正文

here开始,从here开始,我尝试使用pyplot和{}在地图上绘制一个固定大小的圆圈。在

(所谓“固定尺寸”,我的意思是这个圆圈不是一个标记,它不应该适应缩放级别,而是应该保持,比如说,无论缩放级别是什么,直径都应该是25米)。在

我得到的是:

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)

代码运行良好,但当新的活页选项卡打开时,我什么也没有:

enter image description here


Tags: importherematplotlibasfigpltax级别

热门问题