Python使用matplotlib.pyplot as plt绘图图层优先级问题
作者:Ezekiel?Mok 时间:2022-06-10 18:00:37
前言:
在最近做多智能车的控制时,绘制障碍物的时候发现障碍物的图层被路面图层所覆盖,一时不知道怎么解决,其实在用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)
来源:https://blog.csdn.net/Ezekiel_Mok/article/details/124108306
标签:Python,matplotlib.pyplot,as,plt,绘图,图层,优先级
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python3实现的zip格式压缩文件夹操作示例
2023-07-31 18:17:48
oracle dba 应该熟悉的命令
2009-07-02 12:08:00
防止网站被采集的理论分析以及十条方法对策第1/2页
2011-03-29 10:38:00
pycharm无法导入lxml的解决办法
2023-08-24 04:34:39
![](https://img.aspxhome.com/file/2023/2/87922_0s.png)
Python使用Keras OCR实现从图像中删除文本
2022-07-22 20:50:24
![](https://img.aspxhome.com/file/2023/9/80569_0s.jpg)
python 阿里云oss实现直传签名与回调验证的示例方法
2021-12-08 00:30:18
Python3 字典dictionary入门基础附实例
2023-03-08 18:57:49
一个奇怪的CSS现象
2010-02-10 12:28:00
![](https://img.aspxhome.com/file/UploadPic/20102/10/y200921122655-79s.jpg)
7个流行的Python强化学习算法及代码实现详解
2021-07-06 08:38:03
js实现屏蔽默认快捷键调用自定义事件示例
2023-09-05 09:28:31
python使用htmllib分析网页内容的方法
2022-05-22 13:28:33
用ASP实现就MP3曲目信息的操作全攻略
2008-05-28 12:42:00
用正则表达式找出不包含连续字符串abc的单词
2010-03-02 20:28:00
使用python实现下拉选择框和页签的方法
2021-10-01 04:07:41
![](https://img.aspxhome.com/file/2023/1/118541_0s.jpg)
scrapy数据存储在mysql数据库的两种方式(同步和异步)
2023-07-10 03:29:43
![](https://img.aspxhome.com/file/2023/4/62304_0s.png)
python3.6根据m3u8下载mp4视频
2021-05-22 00:20:03
![](https://img.aspxhome.com/file/2023/5/79795_0s.png)
Django migrations 默认目录修改的方法教程
2021-10-15 20:17:59
python中实现将多个print输出合成一个数组
2022-10-27 20:00:26
深入了解和应用Python 装饰器 @decorator
2024-01-02 09:20:05
![](https://img.aspxhome.com/file/2023/2/72152_0s.jpg)
python Airtest自动化测试工具的的使用
2023-10-28 02:12:57
![](https://img.aspxhome.com/file/2023/6/79446_0s.jpg)