您现在的位置是:网站首页> 编程资料编程资料
Python使用matplotlib.pyplot as plt绘图图层优先级问题_python_
2023-05-26
267人已围观
简介 Python使用matplotlib.pyplot as plt绘图图层优先级问题_python_
前言:
在最近做多智能车的控制时,绘制障碍物的时候发现障碍物的图层被路面图层所覆盖,一时不知道怎么解决,其实在用matplotlib.pyplot 绘图的时候可以使用参数zorder设置优先级进行调节,zorder整数越大,显示时越靠上。
调整前:
ax.hlines(y=30, xmin=-50, xmax=200, color='gray', linewidth=50) ax.hlines(y=0, xmin=-50, xmax=200, color='gray', linewidth=50) ax.hlines(y=-30, xmin=-50, xmax=200, color='gray', linewidth=50) obstacle = plt.Circle((120.0, -5.0), 5.0, color='red', fill=True, linewidth=1) obstacle1 = plt.Circle((60.0, 27.0), 5.0, color='red', fill=True, linewidth=1) obstacle2 = plt.Circle((60.0, -29.0), 5.0, color='red', fill=True, linewidth=1)
调整后:
ax.hlines(y=30, xmin=-50, xmax=200, color='gray', linewidth=50, zorder=1) ax.hlines(y=0, xmin=-50, xmax=200, color='gray', linewidth=50, zorder=1) ax.hlines(y=-30, xmin=-50, xmax=200, color='gray', linewidth=50, zorder=1) obstacle = plt.Circle((120.0, -5.0), 5.0, color='red', fill=True, linewidth=1, zorder=2) obstacle1 = plt.Circle((60.0, 27.0), 5.0, color='red', fill=True, linewidth=1, zorder=2) obstacle2 = plt.Circle((60.0, -29.0), 5.0, color='red', fill=True, linewidth=1, zorder=2)
到此这篇关于Python使用matplotlib.pyplot as plt绘图图层优先级问题的文章就介绍到这了,更多相关python图层优先级内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
您可能感兴趣的文章:
相关内容
- Python学习之线程池与GIL全局锁详解_python_
- 详解Python+Matplotlib绘制面积图&热力图_python_
- matplotlib绘制雷达图的基本配置(万能模板案例)_python_
- matplotlib绘制甘特图的万能模板案例_python_
- matplotlib绘制直方图的基本配置(万能模板案例)_python_
- 详解python的字典及相关操作_python_
- Python批量裁剪图形外围空白区域_python_
- Python取读csv文件做dbscan分析_python_
- python将Dataframe格式的数据写入opengauss数据库并查询_python_
- Python使用matplotlib.pyplot as plt绘图图层优先级问题_python_