matplotlib:绘制一条封闭的线 [英] matplotlib:plot a line closed
本文介绍了matplotlib:绘制一条封闭的线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我绘制了一个图,如下所示:
I plot a figure as below:
plt.plot(lon,lat,'ro-')
plt.show()
但是这些行没有关闭.如何使它们以多边形的形式闭合?谢谢
but the lines aren't closed. How can I make them closed as polygons? thank you
推荐答案
使用 matplotlib.pyplot.fill(lon,lat,fill = False)
代替 plot()
>.
请参见 http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.fill 了解详情.颜色字符串是指内部,因此要对多边形使用红色,请使用
See http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.fill for details. The color string refers to the interior, so to use red for the polygon, use
plt.fill(lon, lat, edgecolor='r', fill=False)
,并根据需要继续使用 plot()
在顶点上放置圆.
and continue to use plot()
to place circles on the vertices if desired.
这篇关于matplotlib:绘制一条封闭的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文