简 介: 本文讨论了meshgrid产生的三种方法,特别从meshgrid 到点阵列表之间的转换关系。

关键词meshgridmgrid

#mermaid-svg-6JtzvULJCZcohnGK .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-6JtzvULJCZcohnGK .label text{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .node rect,#mermaid-svg-6JtzvULJCZcohnGK .node circle,#mermaid-svg-6JtzvULJCZcohnGK .node ellipse,#mermaid-svg-6JtzvULJCZcohnGK .node polygon,#mermaid-svg-6JtzvULJCZcohnGK .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-6JtzvULJCZcohnGK .node .label{text-align:center;fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .node.clickable{cursor:pointer}#mermaid-svg-6JtzvULJCZcohnGK .arrowheadPath{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-6JtzvULJCZcohnGK .flowchart-link{stroke:#333;fill:none}#mermaid-svg-6JtzvULJCZcohnGK .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-6JtzvULJCZcohnGK .edgeLabel rect{opacity:0.9}#mermaid-svg-6JtzvULJCZcohnGK .edgeLabel span{color:#333}#mermaid-svg-6JtzvULJCZcohnGK .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-6JtzvULJCZcohnGK .cluster text{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-6JtzvULJCZcohnGK .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-6JtzvULJCZcohnGK text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-6JtzvULJCZcohnGK .actor-line{stroke:grey}#mermaid-svg-6JtzvULJCZcohnGK .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-6JtzvULJCZcohnGK .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-6JtzvULJCZcohnGK #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-6JtzvULJCZcohnGK .sequenceNumber{fill:#fff}#mermaid-svg-6JtzvULJCZcohnGK #sequencenumber{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK #crosshead path{fill:#333;stroke:#333}#mermaid-svg-6JtzvULJCZcohnGK .messageText{fill:#333;stroke:#333}#mermaid-svg-6JtzvULJCZcohnGK .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-6JtzvULJCZcohnGK .labelText,#mermaid-svg-6JtzvULJCZcohnGK .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-6JtzvULJCZcohnGK .loopText,#mermaid-svg-6JtzvULJCZcohnGK .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-6JtzvULJCZcohnGK .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-6JtzvULJCZcohnGK .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-6JtzvULJCZcohnGK .noteText,#mermaid-svg-6JtzvULJCZcohnGK .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-6JtzvULJCZcohnGK .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-6JtzvULJCZcohnGK .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-6JtzvULJCZcohnGK .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-6JtzvULJCZcohnGK .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .section{stroke:none;opacity:0.2}#mermaid-svg-6JtzvULJCZcohnGK .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-6JtzvULJCZcohnGK .section2{fill:#fff400}#mermaid-svg-6JtzvULJCZcohnGK .section1,#mermaid-svg-6JtzvULJCZcohnGK .section3{fill:#fff;opacity:0.2}#mermaid-svg-6JtzvULJCZcohnGK .sectionTitle0{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .sectionTitle1{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .sectionTitle2{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .sectionTitle3{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-6JtzvULJCZcohnGK .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .grid path{stroke-width:0}#mermaid-svg-6JtzvULJCZcohnGK .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-6JtzvULJCZcohnGK .task{stroke-width:2}#mermaid-svg-6JtzvULJCZcohnGK .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .taskText:not([font-size]){font-size:11px}#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-6JtzvULJCZcohnGK .task.clickable{cursor:pointer}#mermaid-svg-6JtzvULJCZcohnGK .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-6JtzvULJCZcohnGK .taskText0,#mermaid-svg-6JtzvULJCZcohnGK .taskText1,#mermaid-svg-6JtzvULJCZcohnGK .taskText2,#mermaid-svg-6JtzvULJCZcohnGK .taskText3{fill:#fff}#mermaid-svg-6JtzvULJCZcohnGK .task0,#mermaid-svg-6JtzvULJCZcohnGK .task1,#mermaid-svg-6JtzvULJCZcohnGK .task2,#mermaid-svg-6JtzvULJCZcohnGK .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutside0,#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutside2{fill:#000}#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutside1,#mermaid-svg-6JtzvULJCZcohnGK .taskTextOutside3{fill:#000}#mermaid-svg-6JtzvULJCZcohnGK .active0,#mermaid-svg-6JtzvULJCZcohnGK .active1,#mermaid-svg-6JtzvULJCZcohnGK .active2,#mermaid-svg-6JtzvULJCZcohnGK .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-6JtzvULJCZcohnGK .activeText0,#mermaid-svg-6JtzvULJCZcohnGK .activeText1,#mermaid-svg-6JtzvULJCZcohnGK .activeText2,#mermaid-svg-6JtzvULJCZcohnGK .activeText3{fill:#000 !important}#mermaid-svg-6JtzvULJCZcohnGK .done0,#mermaid-svg-6JtzvULJCZcohnGK .done1,#mermaid-svg-6JtzvULJCZcohnGK .done2,#mermaid-svg-6JtzvULJCZcohnGK .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-6JtzvULJCZcohnGK .doneText0,#mermaid-svg-6JtzvULJCZcohnGK .doneText1,#mermaid-svg-6JtzvULJCZcohnGK .doneText2,#mermaid-svg-6JtzvULJCZcohnGK .doneText3{fill:#000 !important}#mermaid-svg-6JtzvULJCZcohnGK .crit0,#mermaid-svg-6JtzvULJCZcohnGK .crit1,#mermaid-svg-6JtzvULJCZcohnGK .crit2,#mermaid-svg-6JtzvULJCZcohnGK .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-6JtzvULJCZcohnGK .activeCrit0,#mermaid-svg-6JtzvULJCZcohnGK .activeCrit1,#mermaid-svg-6JtzvULJCZcohnGK .activeCrit2,#mermaid-svg-6JtzvULJCZcohnGK .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-6JtzvULJCZcohnGK .doneCrit0,#mermaid-svg-6JtzvULJCZcohnGK .doneCrit1,#mermaid-svg-6JtzvULJCZcohnGK .doneCrit2,#mermaid-svg-6JtzvULJCZcohnGK .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-6JtzvULJCZcohnGK .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-6JtzvULJCZcohnGK .milestoneText{font-style:italic}#mermaid-svg-6JtzvULJCZcohnGK .doneCritText0,#mermaid-svg-6JtzvULJCZcohnGK .doneCritText1,#mermaid-svg-6JtzvULJCZcohnGK .doneCritText2,#mermaid-svg-6JtzvULJCZcohnGK .doneCritText3{fill:#000 !important}#mermaid-svg-6JtzvULJCZcohnGK .activeCritText0,#mermaid-svg-6JtzvULJCZcohnGK .activeCritText1,#mermaid-svg-6JtzvULJCZcohnGK .activeCritText2,#mermaid-svg-6JtzvULJCZcohnGK .activeCritText3{fill:#000 !important}#mermaid-svg-6JtzvULJCZcohnGK .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-6JtzvULJCZcohnGK g.classGroup text .title{font-weight:bolder}#mermaid-svg-6JtzvULJCZcohnGK g.clickable{cursor:pointer}#mermaid-svg-6JtzvULJCZcohnGK g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-6JtzvULJCZcohnGK g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-6JtzvULJCZcohnGK .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-6JtzvULJCZcohnGK .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-6JtzvULJCZcohnGK .dashed-line{stroke-dasharray:3}#mermaid-svg-6JtzvULJCZcohnGK #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK .commit-id,#mermaid-svg-6JtzvULJCZcohnGK .commit-msg,#mermaid-svg-6JtzvULJCZcohnGK .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-6JtzvULJCZcohnGK g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-6JtzvULJCZcohnGK g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-6JtzvULJCZcohnGK g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-6JtzvULJCZcohnGK .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-6JtzvULJCZcohnGK .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-6JtzvULJCZcohnGK .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-6JtzvULJCZcohnGK .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-6JtzvULJCZcohnGK .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-6JtzvULJCZcohnGK .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-6JtzvULJCZcohnGK .edgeLabel text{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-6JtzvULJCZcohnGK .node circle.state-start{fill:black;stroke:black}#mermaid-svg-6JtzvULJCZcohnGK .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-6JtzvULJCZcohnGK #statediagram-barbEnd{fill:#9370db}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-state .divider{stroke:#9370db}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-6JtzvULJCZcohnGK .note-edge{stroke-dasharray:5}#mermaid-svg-6JtzvULJCZcohnGK .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-6JtzvULJCZcohnGK .error-icon{fill:#522}#mermaid-svg-6JtzvULJCZcohnGK .error-text{fill:#522;stroke:#522}#mermaid-svg-6JtzvULJCZcohnGK .edge-thickness-normal{stroke-width:2px}#mermaid-svg-6JtzvULJCZcohnGK .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-6JtzvULJCZcohnGK .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-6JtzvULJCZcohnGK .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-6JtzvULJCZcohnGK .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-6JtzvULJCZcohnGK .marker{fill:#333}#mermaid-svg-6JtzvULJCZcohnGK .marker.cross{stroke:#333}:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-6JtzvULJCZcohnGK {color: rgba(0, 0, 0, 0.75);font: ;}

分类界面
文章目录
meshgrid与mgrid
meshgrid
mgrid
双重for循环
meshgrid与坐
标对相互转换
总 结

§01 分类界面


  分类器机器学习数据挖掘 中最要的分析方法。在 sklearn中分类器的比较 对比了十种不同的分类器的分类洁面效果。这可帮助我们进一步了解各个分类器的特征。

▲ 图1.1 十种分类器的分类界面

  下面对于sklearn中分类器的比较中的分类器显示界面进行初步的测试。

1.1 meshgrid与mgrid

  在绘制分类界面以及其他性能曲面的时候,生成格点坐标用来计算曲面每个点的数值,然后才可以进行显示。 从 numpy meshgrid 和 mgrid 的两个简单实例和解析 介绍了生成格点的几种方法。

1.1.1 meshgrid

import sys,os,math,time
import matplotlib.pyplot as plt
from numpy import *a = list(range(5))
b = list(range(3))print("a: {}".format(a),"b: {}".format(b))
a: [0, 1, 2, 3, 4]
b: [0, 1, 2]
x,y = meshgrid(a,b)
print("x: {}".format(x), "y: {}".format(y))
x: [[0 1 2 3 4]
[0 1 2 3 4]
[0 1 2 3 4]]y: [[0 0 0 0 0]
[1 1 1 1 1]
[2 2 2 2 2]]
x,y = meshgrid(range(5), range(3))
print("x: {}".format(x), "y: {}".format(y))
x: [[0 1 2 3 4]
[0 1 2 3 4]
[0 1 2 3 4]]
y: [[0 0 0 0 0]
[1 1 1 1 1]
[2 2 2 2 2]]

1.1.2 mgrid

(1)基本用法

x,y = mgrid[0:5, 0:3]
print("x: {}".format(x), "y: {}".format(y))
x: [[0 0 0]
[1 1 1]
[2 2 2]
[3 3 3]
[4 4 4]]
y: [[0 1 2]
[0 1 2]
[0 1 2]
[0 1 2]
[0 1 2]]

  通过上面对比,可以看到: meshgrid(range(5), range(3)) 与 mgrid[0:5,0:3]所生成的格点矩阵是不同。

(2)声明格点数量

x,y = mgrid[0:5:10j, 0:3:5j]
print("x: {}".format(x), "y: {}".format(y))
x: [[0.         0.         0.         0.         0.        ]
[0.55555556 0.55555556 0.55555556 0.55555556 0.55555556]
[1.11111111 1.11111111 1.11111111 1.11111111 1.11111111]
[1.66666667 1.66666667 1.66666667 1.66666667 1.66666667]
[2.22222222 2.22222222 2.22222222 2.22222222 2.22222222]
[2.77777778 2.77777778 2.77777778 2.77777778 2.77777778]
[3.33333333 3.33333333 3.33333333 3.33333333 3.33333333]
[3.88888889 3.88888889 3.88888889 3.88888889 3.88888889]
[4.44444444 4.44444444 4.44444444 4.44444444 4.44444444]
[5.         5.         5.         5.         5.        ]]
y: [[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]
[0.   0.75 1.5  2.25 3.  ]]

  当mgrid切片的第三个参数为虚数的时候,它表示对间隔进行细分多少份。

1.1.3 双重[for]循环

xy = [(a,b) for b in range(3) for a in range(5)]
print("xy: {}".format(xy))
xy: [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (0, 2), (1, 2), (2, 2), (3, 2), (4, 2)]
x1 = [x[0] for x in xy]
x2 = [x[1] for x in xy]
print("x1: {}".format(x1),"x2: {}".format(x2))
x1: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4]
x2: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2]
print(list(zip(*([iter(x1)]*5))))
print(list(zip(*([iter(x2)]*5))))
[(0, 1, 2, 3, 4), (0, 1, 2, 3, 4), (0, 1, 2, 3, 4)]
[(0, 0, 0, 0, 0), (1, 1, 1, 1, 1), (2, 2, 2, 2, 2)]

1.1.4 meshgrid与坐标对相互转换

(1)meshgrid转换成坐标对

x = mgrid[0:5,0:3]
print("x: {}".format(x),"x.T: {}".format(x.T))
x: [[[0 0 0]
[1 1 1]
[2 2 2]
[3 3 3]
[4 4 4]]
[[0 1 2]
[0 1 2]
[0 1 2]
[0 1 2]
[0 1 2]]]
x.T: [[[0 0]
[1 0]
[2 0]
[3 0]
[4 0]]
[[0 1]
[1 1]
[2 1]
[3 1]
[4 1]]
[[0 2]
[1 2]
[2 2]
[3 2]
[4 2]]]
x = mgrid[0:5,0:3].T.reshape(-1,2)
print("x: {}".format(x))
x: [[0 0]
[1 0]
[2 0]
[3 0]
[4 0]
[0 1]
[1 1]
[2 1]
[3 1]
[4 1]
[0 2]
[1 2]
[2 2]
[3 2]
[4 2]]

(2)坐标对转换成meshgrid

x = x.reshape(3,5,-1).T
print("x: {}".format(x))
x: [[[0 0 0]
[1 1 1]
[2 2 2]
[3 3 3]
[4 4 4]]
[[0 1 2]
[0 1 2]
[0 1 2]
[0 1 2]
[0 1 2]]]

§02 总  结


  本文讨论了meshgrid产生的三种方法,特别从meshgrid 到点阵列表之间的转换关系。


■ 相关文献链接:

  • 分类器
  • 机器学习
  • 数据挖掘
  • sklearn中分类器的比较
  • numpy meshgrid 和 mgrid 的两个简单实例和解析

● 相关图表链接:

  • 图1.1 十种分类器的分类界面

绘制分类界面以及性能曲面中的meshgrid函数相关推荐

  1. python grid函数_详解numpy中的meshgrid函数用法

    numpy中的meshgrid函数的使用 numpy官方文档meshgrid函数帮助文档https://docs.scipy.org/doc/numpy/reference/generated/num ...

  2. Python——根据散点数据绘制三维曲面图( meshgrid函数以及Axes3D [plot_surface] )

    1.初始散点数据处理成xy网格数据 import numpy as np x = np.arange(-2, 2, 0.025) y = np.arange(-2, 2, 0.025) x, y = ...

  3. Numpy中的meshgrid()函数

    官方解释: np.meshgrid(*xi, **kwargs) Return coordinate matrices from coordinate vectors. 从坐标向量中返回坐标矩阵 不够 ...

  4. numpy中的meshgrid函数

    numpy官方文档meshgrid函数帮助文档https://docs.scipy.org/doc/numpy/reference/generated/numpy.meshgrid.html mesh ...

  5. python中grid函数_numpy中的meshgrid函数的使用

    meshgrid(*xi, **kwargs) 功能:从一个坐标向量中返回一个坐标矩阵 参数: x1,x2...,xn:数组,一维的数组代表网格的坐标. indexing:{'xy','ij'},笛卡 ...

  6. Matlab中的meshgrid函数

    参考: https://blog.csdn.net/hhhhhyyyyy8/article/details/76209094 matlab函数手册 meshgrid是Matlab中用于生成网络采样点的 ...

  7. 利用Axes3D绘制三维性能曲面

    简 介: 绘制二维函数的3D曲面图可以帮助我们更好理解函数内所蕴含的规律.Axes3D是matplotlib中的绘制函数.利用surface, countour,countourf等可以很好的显示函数 ...

  8. php中include的作用,PHP 中关于 include() 函数的性能

    简明现代魔法 -> PHP服务器脚本 -> PHP 中关于 include() 函数的性能 PHP 中关于 include() 函数的性能 2010-03-03 PHP程序员最常用的两个函 ...

  9. python中grid函数_Python-Numpy模块Meshgrid函数

    Numpy中关于Meshgrid函数:meshgrid官方. 1.Meshgrid前言 meshgrid函数就是用两个坐标轴上的点在平面上画网格(当然这里传入的参数是两个的时候).当然我们可以指定多个 ...

最新文章

  1. 【配置文件】log4j是什么log4j
  2. STM32F103五分钟入门系列(十三)独立看门狗IWDG
  3. Linux启动或重启网卡【命令】
  4. 单点登陆(SSO)组件的设计与实现一 【转】
  5. 移动端web 禁止长按弹出的菜单 Safari
  6. webpack 4.0 学习笔记(一)
  7. 不搞虚的!快速把你拉入Docker 的门里 | 原力计划
  8. 流迭代器实现文件操作(读取和写入)
  9. Python渗透测试之身份认证攻击
  10. 联想服务器修改ip地址,联想 lenove 3750 M4服务器更改启动项和管理口IP
  11. 使用YALMIP 求解LMI时遇到的问题
  12. Carplay车载语音通讯测试(Vehicle Communication Terminals Test)
  13. 爱奇艺大数据实时分析平台的建设与实践
  14. 烽火算法题 报数问题(不是约瑟夫环)双向链表 Java实现与C实现
  15. ubuntu简繁体输入法快捷键转换
  16. 操作系统实验四-LRU算法的模拟
  17. codeforces 2022.11.22-11.29
  18. 新技术或语言学习方法总结
  19. bicq php,BICQ   1、首先 软件跟QQ和MSN有很多类似的地方。因为现在 用户群在使用 WEB(ASP,PHP,...) 256万源代码下载- www.pudn.com...
  20. OpenMLDB新手入门开源介绍

热门文章

  1. python第二阶段 第六天 模块
  2. docker搭建 LNMP 环境
  3. kafka 基础知识梳理及集群环境部署记录
  4. 在Oracle中IMP导入数据时,如何解决目标数据库字符不一致问题
  5. 工控安全要避开传统IT安全思路的几个“暗坑”
  6. Java Socket实现WebSocket服务器
  7. 利用套接字实现进程通信一例
  8. Vue.Draggable 实现组件拖拽
  9. iOS唯一标示符引导
  10. qt与python互联_PYQT5 vscode联合操作qtdesigner的方法