- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试绘制具有指定水平的模拟速度场的等高线,我的值在 [75,150] 范围内,我指定我的水平为 levels=[75,95,115,135,150]
, 但它只给我 95,115,135 行。我检查了我的 2d 数组,我确实有值 75 和 150 的点位于直线上,但绘图只是没有显示它们。我想知道为什么会这样。多谢!!这是我的代码:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
#some parameters...does not matter
i=60*np.pi/180 #inclination
r=100 #radius
vc=150
vr=0
x=np.arange(-100,100,1)
y=np.arange(-100,100,1)
xx,yy=np.meshgrid(x,y)
#simulate velocity fields....does not matter either
def projv((x, y),v_c, v_r, inc):
projvy = v_c*x*np.cos(inc)/np.sqrt(x**2+y**2) + v_r*y*np.cos(inc)/np.sqrt(x**2+y**2)
projvx = v_c*y/np.sqrt(x**2+y**2) + v_r*x/np.sqrt(x**2+y**2)
v = np.sqrt(projvx**2 + projvy**2)
return v.ravel()
#here is my 2d array
vel = projv((xx,yy),vc, vr, i).reshape(200,200)
#levels I specified
levels=[75,95,115,135,150]
cs=plt.contour(x,y,vel,levels)
plt.clabel(cs,inline=1,fontsize=9)
plt.show()
最佳答案
您缺少 75 和 150 等高线,因为这些值在数组中从未交叉。值 150 存在,值 75(.000000000000014) 存在,但这些是最小值和最大值。等高线描述了一条线/面边界。
#levels modified
levels=[76,95,115,135,149]
cs=plt.contour(x,y,vel,levels)
plt.clabel(cs,inline=1,fontsize=9)
关于python - python 等高线图中缺少级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39922504/
我试图理解 findContours 的输出基于 this one 等教程和文档。我想知道为什么我得到我得到的输出。我有一个中间有一个正方形的 jpeg img,我的目标是找到正方形并为其着色(只是为
我有一组数据,其中包含 x 和 y 坐标以及每个坐标的计算值。网格是不规则的,所以现在我一直在创建一个散点图并将值分成多个箱子,以显示为下面链接中 img 上的等高线。 http://i.stack.
这个问题在这里已经有了答案: Test if a numpy array is a member of a list of numpy arrays, and remove it from the
我有一个存储为栅格的高程图。我想将平滑的“vector ”曲线拟合到恒定高度的轮廓。在我的应用程序中,数据实际上是地理海拔,但问题可以推广到两个变量的任何函数。 如果有帮助,我可以生成另一个具有抗锯齿
我想生成一个带有颜色条的等高线图/热图,然后添加一个注释框。这个数字很丑,但得到了我想要的: add_subplot() 是不够的。如果我尝试将所有内容都放在同一个子图中,则该框会被遮盖。我可以通过使
我正在尝试使用属于 ROOT 的 Minuit2 最小化器为具有物理限制的参数生成等高线图数据分析框架。不幸的是,当我尝试生成等高线图时,Minuit2 似乎有意将参数漂移到超出其限制的区域: >>>
我的目标是这种效果:(仅水平轮廓线): 我确实找到了 this example ,但是它会创建水平 和 垂直轮廓线。我无法完全理解如何调用 fwidth()正在生成线条。 uniform float
大家好,我是编程新手,我正在尝试做一些可能非常明显的事情,但对于我来说,我无法弄明白。我有一系列 x、y、z 数据(在我的例子中,对应于距离、深度和 pH 值)。我想使用 matplotlib 在 x
我是一名优秀的程序员,十分优秀!