当前位置:网站首页>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')
边栏推荐
- 记一次实习的经历,趟坑必备(一)
- 技能梳理[email protected]體感機械臂
- Go -- standard library sort package
- Migrate full RT thread to gd32f4xx (detailed)
- Notes on numerical calculation - iterative solution of linear equations
- ionic4 ion-reorder-group组件拖拽改变item顺序
- GD32 RT-Thread PWM驱动函数
- Turn to cartoon learning notes
- 历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并
- CSDN博客运营团队2022年H1总结
猜你喜欢

Remember the experience of an internship. It is necessary to go to the pit (I)

文件共享服务器

苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...

Yixian e - commerce publie un rapport trimestriel: adhérer à la R & D et à l’investissement de la marque, réaliser un développement durable et de haute qualité

mysql数据库基础:约束、标识列
[email protected]体感机械臂"/>技能梳理[email protected]体感机械臂

最新SCI影响因子公布:国产期刊最高破46分!网友:算是把IF玩明白了

CVPR 2022 | 清华&字节&京东提出BrT:用于视觉和点云3D目标检测的桥接Transformer

Dyson design award, changing the world with sustainable design

腾讯云数据库工程师能力认证重磅推出,各界共话人才培养难题
随机推荐
Musk has more than 100 million twitter fans, but he has been lost online for a week
那个程序员,被打了。
[deep learning] common methods for deep learning to detect small targets
Anhui "requirements for design depth of Hefei fabricated building construction drawing review" was printed and distributed; Hebei Hengshui city adjusts the pre-sale license standard for prefabricated
CVPR 2022 | 清华&字节&京东提出BrT:用于视觉和点云3D目标检测的桥接Transformer
机器学习面试准备(一)KNN
断路器HystrixCircuitBreaker
Ionic4 drag the ion reorder group component to change the item order
Highlight display of Jinbei LB box, adhering to mini special effects
CVPR 2022 | Tsinghua & bytek & JD put forward BRT: Bridging Transformer for vision and point cloud 3D target detection
苹果5G芯片被曝研发失败,QQ密码bug引热议,蔚来回应做空传闻,今日更多大新闻在此...
Oracle creates a stored procedure successfully, but the compilation fails
Typescript – classes in Es5, inheritance, static methods
Go -- standard library sort package
转卡通学习笔记
Dow Jones Industrial Average
7 大轻量易用的工具,给开发者减压提效,助力企业敏捷上云 | Techo Day 精彩回顾...
潘多拉 IOT 开发板学习(HAL 库)—— 实验1 跑马灯(RGB)实验(学习笔记)
Arm新CPU性能提升22%,最高可组合12核,GPU首配硬件光追,网友:跟苹果的差距越来越大了...
matplotlib 笔记: contourf & contour




