当前位置:网站首页>Matplotlib notes: contour & Contour
Matplotlib notes: contour & Contour
2022-06-30 10:43:00 【UQI-LIUWJ】
contour and contourf Draw contour lines and fill contour lines respectively
1 Basic usage
matplotlib.pyplot.contourf([X, Y,] Z, [levels], **kwargs)2 main parameter
| X, Y | Z Coordinates of values in . X and Y Must be two-dimensional , Have and Z The same shape ( for example , adopt numpy.meshgrid establish ), Or they must all be one-dimensional , such len(X) == N ,len(Y ) == M yes Z The number of rows and columns in . X and Y Must be sorted monotonically . |
| z | Draw the height value of the contour line . |
| levels | Determine contour lines / Number and location of areas . If it's an integer n, Please use MaxNLocator, It will try to vmin and vmax No more than... Are automatically selected between n+1 individual ” good “ At the same high level . If it's an array , Contour lines are drawn at the specified level . These values must be arranged in ascending order . |
| colors | Color of level , That is, contour lines and contour areas . This sequence loops through the levels in ascending order . If the sequence is shorter than the number of levels , Then repeat . As a shortcut , You can use a single color string instead of a single element list , namely “red” instead of [“red”] Color all levels with the same color . By default ( value None), Will use cmap Specified color map . |
| cmap | ![]() |
| alpha | transparency ,0~1 Number between |
| extend | Determines the outline shading of values outside the level range . If “both”, Values outside the level range are not shaded . If it is “min”、“max” or “both”, Is less than 、 Values above or below and above the horizontal range are shaded . lower than min(levels) And above max(levels) The value of is mapped to the lower than of the color map / Above value . |
3 give an example
3.0 Data section
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1, 10)
y = x.reshape(-1, 1)
h = x * y
print(x,'\n',y,'\n',h)
'''
[1 2 3 4 5 6 7 8 9]
[[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]]
[[ 1 2 3 4 5 6 7 8 9]
[ 2 4 6 8 10 12 14 16 18]
[ 3 6 9 12 15 18 21 24 27]
[ 4 8 12 16 20 24 28 32 36]
[ 5 10 15 20 25 30 35 40 45]
[ 6 12 18 24 30 36 42 48 54]
[ 7 14 21 28 35 42 49 56 63]
[ 8 16 24 32 40 48 56 64 72]
[ 9 18 27 36 45 54 63 72 81]]
'''3.1 The most basic
plt.contourf(x.reshape(-1),
y.reshape(-1),
h)
3.2 level
plt.contourf(x.reshape(-1), y.reshape(-1), h, levels=1)
plt.contourf(x.reshape(-1), y.reshape(-1), h, levels=[1,3,15,35])
3.3 extend
plt.contourf(x.reshape(-1), y.reshape(-1), h, levels=[13,15,35], )
plt.contourf(x.reshape(-1), y.reshape(-1), h, levels=[13,15,35], extend='both')
边栏推荐
- nvm、nrm、npx使用(安装、基本命令、参数、curl、wget)
- 【Rust每周一库】num-bigint - 大整数
- ArcGIS Pro脚本工具(5)——排序后删除重复项
- [rust weekly database] num bigint - large integer
- Use keil5 software to simulate and debug gd32f305 from 0
- 最新SCI影响因子公布:国产期刊最高破46分!网友:算是把IF玩明白了
- pytorch 笔记 torch.nn.BatchNorm1d
- CSDN博客运营团队2022年H1总结
- June training (day 30) - topology sorting
- pytorch 笔记:validation ,model.eval V.S torch.no_grad
猜你喜欢

Auto Seg-Loss: 自动损失函数设计

ArcGIS Pro scripting tool (5) - delete duplicates after sorting

再测云原生数据库性能:PolarDB依旧最强,TDSQL-C、GaussDB变化不大
[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled"/>技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled
[email protected]体感机械臂"/>技能梳理[email protected]体感机械臂

Android 开发面试真题进阶版(附答案解析)

智能DNA分子纳米机器人模型来了

记一次实习的经历,趟坑必备(一)

【深度学习】深度学习检测小目标常用方法
[email protected]體感機械臂"/>技能梳理[email protected]體感機械臂
随机推荐
Musk has more than 100 million twitter fans, but he has been lost online for a week
js常见问题
那个程序员,被打了。
【深度学习】深度学习检测小目标常用方法
Node environment configuration
Get through the supply chain Shenzhen gift show helps cross-border e-commerce find ways to break the situation
Jinbei LT6 is powerful in the year of the tiger, making waves
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
Skill combing [email protected] somatosensory manipulator
ArcGIS Pro脚本工具(6)——修复CAD图层数据源
转卡通学习笔记
R language plot visualization: use plot to visualize the prediction confidence of the multi classification model, the prediction confidence of each data point of the model in the 2D grid, and the conf
About Library (function library), dynamic library and static library
[rust daily] the first rust monthly magazine on January 22, 2021 invites everyone to participate
Who should the newly admitted miners bow to in front of the chip machine and the graphics card machine
今晚19:00知识赋能第2期直播丨OpenHarmony智能家居项目之控制面板界面设计
RobotFramework学习笔记:环境安装以及robotframework-browser插件的安装
Getting started with X86 - take over bare metal control
Harvester ch1 of CKB and HNS, connection tutorial analysis
Gd32 RT thread RTC driver function




