从 Python 中的密度图中找出所有满足 .. 的值
Find all values such that .. from a density plot in Python
我绘制了 (x,y) 图表,我想为它找到两件事:
- y > 某个指定值的所有 x 值,
- y > 某个指定值的所有 y 值。
我该怎么做?
使用 numpy:
import numpy as np
x = np.linspace(0,25,101) #x: 101 values between 0 and 25
y = x**2/20
x[y>30] #filter output: [ 24.5 , 24.75, 25. ]
y[y>30] #filter output: [ 30.0125 , 30.628125, 31.25 ]
这假定您可以访问生成绘图的值。
我绘制了 (x,y) 图表,我想为它找到两件事: - y > 某个指定值的所有 x 值, - y > 某个指定值的所有 y 值。
我该怎么做?
使用 numpy:
import numpy as np
x = np.linspace(0,25,101) #x: 101 values between 0 and 25
y = x**2/20
x[y>30] #filter output: [ 24.5 , 24.75, 25. ]
y[y>30] #filter output: [ 30.0125 , 30.628125, 31.25 ]
这假定您可以访问生成绘图的值。