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)

Python使用matplotlib.pyplot as plt绘图图层优先级问题

调整后: 

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绘图图层优先级问题

来源:https://blog.csdn.net/Ezekiel_Mok/article/details/124108306

标签:Python,matplotlib.pyplot,as,plt,绘图,图层,优先级
0
投稿

猜你喜欢

  • 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
  • Python使用Keras OCR实现从图像中删除文本

    2022-07-22 20:50:24
  • python 阿里云oss实现直传签名与回调验证的示例方法

    2021-12-08 00:30:18
  • Python3 字典dictionary入门基础附实例

    2023-03-08 18:57:49
  • 一个奇怪的CSS现象

    2010-02-10 12:28:00
  • 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
  • scrapy数据存储在mysql数据库的两种方式(同步和异步)

    2023-07-10 03:29:43
  • python3.6根据m3u8下载mp4视频

    2021-05-22 00:20:03
  • Django migrations 默认目录修改的方法教程

    2021-10-15 20:17:59
  • python中实现将多个print输出合成一个数组

    2022-10-27 20:00:26
  • 深入了解和应用Python 装饰器 @decorator

    2024-01-02 09:20:05
  • python Airtest自动化测试工具的的使用

    2023-10-28 02:12:57
  • asp之家 网络编程 m.aspxhome.com