当前位置:网站首页>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')
边栏推荐
- Node environment configuration
- My in-depth remote office experience | community essay solicitation
- pytorch 笔记:validation ,model.eval V.S torch.no_grad
- 技能梳理[email protected]+adxl345+电机震动+串口输出
- 如何解决跨域
- 无心剑中译狄金森《灵魂择其伴侣》
- 记一次实习的经历,趟坑必备(一)
- ArcGIS Pro scripting tool (5) - delete duplicates after sorting
- 历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并
- Test memory read rate
猜你喜欢

从0使用keil5软件仿真调试GD32F305

I found a wave of "alchemy artifact" in the goose factory. The developer should pack it quickly

透过华为军团看科技之变(五):智慧园区

历史上的今天:微软收购 PowerPoint 开发商;SGI 和 MIPS 合并

再测云原生数据库性能:PolarDB依旧最强,TDSQL-C、GaussDB变化不大
[email protected] voice module +stm32+nfc"/>Skill combing [email protected] voice module +stm32+nfc

Dow Jones Industrial Average
[email protected]体感机械臂"/>技能梳理[email protected]体感机械臂

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

ArcGIS Pro脚本工具(6)——修复CAD图层数据源
随机推荐
我在鹅厂淘到了一波“炼丹神器”,开发者快打包
技能梳理[email protected]体感机械臂
Smith chart view of semi steel coaxial RF line and RF line matching calibration of network analyzer e5071c
GD32 RT-Thread DAC驱动函数
pytorch 笔记:validation ,model.eval V.S torch.no_grad
Voir le changement technologique à travers la Légion Huawei (5): Smart Park
Leetcode question brushing (III) -- binary search (go Implementation)
Leetcode question brushing (I) -- double pointer (go Implementation)
GeoffreyHinton:我的五十年深度学习生涯与研究心法
Skill sorting [email protected]+adxl345+ Motor vibration + serial port output
那个程序员,被打了。
How to deploy deflationary combustion destruction contract code in BSC chain_ Deploy dividend and marketing wallet contract code
Go -- standard library sort package
IPhone address book import into Excel
半钢同轴射频线的史密斯圆图查看和网络分析仪E5071C的射频线匹配校准
Circuit breaker hystrixcircuitbreaker
Auto Seg-Loss: 自动损失函数设计
The human agent of kDa, Jinbei kd6, takes you to explore the metauniverse
[deep learning] common methods for deep learning to detect small targets
ArcGIS Pro脚本工具(6)——修复CAD图层数据源




