当前位置:网站首页>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')
边栏推荐
- 内存逃逸分析
- Enter the world of helium (hNT) hotspot servers to bring you different benefits
- ionic4 ion-reorder-group组件拖拽改变item顺序
- 从0使用keil5软件仿真调试GD32F305
- Arm新CPU性能提升22%,最高可组合12核,GPU首配硬件光追,网友:跟苹果的差距越来越大了...
- mysql数据库基础:视图、变量
- Turn to cartoon learning notes
- CSDN daily one practice 2021.11.06 question 1 (C language)
- ArcGIS Pro scripting tool (6) -- repairing CAD layer data sources
- Skill combing [email protected] control a dog's running on OLED
猜你喜欢

Use keil5 software to simulate and debug gd32f305 from 0

Dyson design award, changing the world with sustainable design
[email protected]在oled上控制一条狗的奔跑"/>技能梳理[email protected]在oled上控制一条狗的奔跑

Compétences Comb 27 @ Body sense Manipulator

苹果高管公然“开怼”:三星抄袭 iPhone,只加了个大屏
[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled"/>技能梳理[email protected]+阿里云+nbiot+dht11+bh1750+土壤湿度传感器+oled

Criu enables hot migration

【深度学习】深度学习检测小目标常用方法

go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)

CSDN blog operation team 2022 H1 summary
随机推荐
Dyson design award, changing the world with sustainable design
nvm、nrm、npx使用(安装、基本命令、参数、curl、wget)
About Library (function library), dynamic library and static library
pytorch 笔记:validation ,model.eval V.S torch.no_grad
技能梳理[email protected]在oled上控制一条狗的奔跑
Skill combing [email protected] intelligent instrument teaching aids based on 51 series single chip microcomputer
断路器HystrixCircuitBreaker
mysql数据库基础:约束、标识列
JS FAQs
7 大轻量易用的工具,给开发者减压提效,助力企业敏捷上云 | Techo Day 精彩回顾...
MySQL从入门到精通50讲(三十二)-ScyllaDB生产环境集群搭建
Pandora IOT development board learning (HAL Library) - Experiment 1 running lantern (RGB) experiment (learning notes)
移植完整版RT-Thread到GD32F4XX(详细)
GD32 RT-Thread RTC驱动函数
ArcGIS Pro脚本工具(5)——排序后删除重复项
Android 开发面试真题进阶版(附答案解析)
Enter the world of helium (hNT) hotspot servers to bring you different benefits
滴滴开源敏捷测试用例管理平台!
js常见问题
Dow Jones Industrial Average




