当前位置:网站首页>matplotlib画polygon, circle
matplotlib画polygon, circle
2022-08-03 19:30:00 【whuzhang16】
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon, Circle
from matplotlib.collections import PatchCollection
import json
result = open("Walls.json","r",encoding="utf-8")
print(type(result))
data = json.load(result)
outlines = data['outlines']
print(len(outlines))
patches = []
for lines in outlines:
poly = []
for key, value in lines.items():
point = []
for k, v in value.items():
if k != "z":
point.append(float(v)/100.0)
poly.append(point)
polygon = Polygon(poly, True)
patches.append(polygon)
result = open("Pillars.json","r",encoding="utf-8")
print(type(result))
data = json.load(result)
outlines = data['outlines']
print(len(outlines))
for lines in outlines:
poly = []
for key, value in lines.items():
point = []
for k, v in value.items():
if k != "z":
point.append(float(v)/100.0)
poly.append(point)
polygon = Polygon(poly, True)
patches.append(polygon)
fig, ax = plt.subplots()
ax.axis([-65,65,-100,30])
colors = 100*np.random.rand(len(patches))
p = PatchCollection(patches, alpha=0.4)
p.set_array(np.array(colors))
ax.add_collection(p)
fig.colorbar(p, ax=ax)
plt.show()边栏推荐
- 开源教育论坛| ChinaOSC
- MVC vs MVP
- 盘点在线帮助中心对企业能够起到的作用
- C#爬虫之通过Selenium获取浏览器请求响应结果
- 基础软件与开发语言开源论坛| ChinaOSC
- APT级全面免杀与企业纵深防御体系的红蓝对抗
- Network protocol-TCP, UDP difference and TCP three-way handshake, four wave
- Unity获取canvas 下ui 在屏幕中的实际坐标
- The addition and subtraction of the score of the force deduction brush question (a daily question 7/27)
- 盘点在线帮助中心对企业能够起到的作用
猜你喜欢
随机推荐
群辉查看硬盘存储占用的方式
net-snmp编译报错:/usr/bin/ld: cannot find crti.o: No such file or directory
线上一次JVM FullGC搞得整晚都没睡,彻底崩溃
net-snmp私有mib动态加载到snmpd
mysql跨库关联查询(dblink)
Cobalt Strike (CS) 逆向初探
七夕之前,终于整出了带AI的美丽秘笈
阿里巴巴政委体系-第八章、阿里政委工作方法论
友宏医疗与Actxa签署Pre-M Diabetes TM 战略合作协议
高效目标检测:动态候选较大程度提升检测精度(附论文下载)
Don't look down upon the WebSocket!Long connection, stateful, two-way, full-duplex king is Fried
【QT】入门心法
OneNote 教程,如何在 OneNote 中设置页面格式?
Handler 源码解析
relocation R_X86_64_PC32 against,/usr/bin/ld: final link failed: Bad value
DeepMCP网络详解
系统太多,多账号互通如何实现?
力扣刷题之爬楼梯(7/30)
ctfshow php特性
阿洛的反思









