当前位置:网站首页>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()边栏推荐
- net-snmp私有mib动态加载到snmpd
- Postgresql源码(65)新快照体系Globalvis工作原理分析
- LOL英雄联盟卡顿掉帧问题解决办法 2022年8月1日
- 群辉查看硬盘存储占用的方式
- MYSQL误删数据恢复
- 开发即时通讯到底需要什么样的技术,需要多久的时间
- 读取 resources 目录下的文件路径的九种方式,你知道多少?
- 花 30 美金请 AI 画家弄了个 logo,网友:画得非常好,下次别画了!
- Redis 内存满了怎么办?这样置才正确!
- Postgresql source code (64) Query execution - data structure and execution process before submodule Executor (2) execution
猜你喜欢
随机推荐
ERROR: You don‘t have the SNMP perl module installed.
Execute the mysql script file in the docker mysql container and solve the garbled characters
阿里二面:多线程间的通信方式有几种?举例说明
软件测试技术之如何编写测试用例(3)
花 30 美金请 AI 画家弄了个 logo,网友:画得非常好,下次别画了!
力扣刷题之爬楼梯(7/30)
京东云发布新一代分布式数据库StarDB 5.0
【QT】入门心法
Postgresql snapshot optimization Globalvis new system analysis (performance greatly enhanced)
The addition and subtraction of the score of the force deduction brush question (a daily question 7/27)
FreeRTOS中级篇
Postgresql源码(64)查询执行——子模块Executor(2)执行前的数据结构和执行过程
Redis 内存满了怎么办?这样置才正确!
Postgresql-xl global snapshot and GTM code walking (branch line)
Unity获取canvas 下ui 在屏幕中的实际坐标
国产虚拟化云宏CNware WinStack安装体验-5 开启集群HA
按需视觉识别:愿景和初步方案
Teach you to locate online MySQL slow query problem hand by hand, package teaching package meeting
力扣刷题之分数加减运算(每日一题7/27)
CS免杀姿势







