当前位置:网站首页>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()边栏推荐
- docker mysql 容器中执行mysql脚本文件并解决乱码
- Postgresql source code (64) Query execution - data structure and execution process before submodule Executor (2) execution
- 国产虚拟化云宏CNware WinStack安装体验-5 开启集群HA
- OneNote 教程,如何在 OneNote 中设置页面格式?
- Postgresql-xl global snapshot and GTM code walking (branch line)
- Postgresql源码(65)新快照体系Globalvis工作原理分析
- Handler source code analysis
- LOL英雄联盟卡顿掉帧问题解决办法 2022年8月1日
- 开源教育论坛| ChinaOSC
- 告诉你0基础怎么学好游戏建模?
猜你喜欢
随机推荐
SQL server 实现触发器备份表数据
阿里二面:多线程间的通信方式有几种?举例说明
【微信小程序】NFC 标签打开小程序
Word另存为PDF后无导航栏解决办法
基础软件与开发语言开源论坛| ChinaOSC
阿里巴巴政委体系-第七章、阿里政委培育
面试突击:什么是粘包和半包?怎么解决?
群辉查看硬盘存储占用的方式
X86函数调用模型分析
Brush the topic of mobile zero power button
力扣刷题之分数加减运算(每日一题7/27)
【leetcode】剑指 Offer II 008. 和大于等于 target 的最短子数组(滑动窗口,双指针)
YAML中多行字符串的配置方法:|+、 |、 |-、 >+、 >、 >-的区别
awk语法-02-运算、数组、格式化输出
The addition and subtraction of the score of the force deduction brush question (a daily question 7/27)
开源教育论坛| ChinaOSC
阿里巴巴政委体系-第九章、阿里政委启示录
按需视觉识别:愿景和初步方案
Postgresql-xl global snapshot and GTM code walking (branch line)
Don't look down upon the WebSocket!Long connection, stateful, two-way, full-duplex king is Fried









