当前位置:网站首页>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()边栏推荐
猜你喜欢
随机推荐
Shell programming loop statement
讯方实训云平台——加速教育高质量发展的“数字底座”!
net-snmp私有mib动态加载到snmpd
Jingdong cloud released a new generation of distributed database StarDB 5.0
梅科尔工作室-14天华为培训七
【C语言学习笔记(六)】分支与跳转(if、else、continue、break、switch)
ERROR: You don‘t have the SNMP perl module installed.
Postgresql源码(65)新快照体系Globalvis工作原理分析
开源教育论坛| ChinaOSC
高性能计算软件与开源生态| ChinaOSC
盘点在线帮助中心对企业能够起到的作用
基础软件与开发语言开源论坛| ChinaOSC
Network protocol-TCP, UDP difference and TCP three-way handshake, four wave
花 30 美金请 AI 画家弄了个 logo,网友:画得非常好,下次别画了!
The effective square of the test (one question of the day 7/29)
YAML中多行字符串的配置方法:|+、 |、 |-、 >+、 >、 >-的区别
分享即时通讯开发之WebSocket:概念、原理、易错常识、动手实践
【木马免杀】
Solution for no navigation bar after Word is saved as PDF
X86函数调用模型分析









