[英]How can I get Isocontour's xy coordinates for contour plot?
我正在嘗試從 3D plot 獲取等值面的 xy 坐標。這是我的嘗試;
import matplotlib.pyplot as plt
from numpy import pi, cos, sin, linspace, meshgrid
x = linspace(0,50,1000)
y = linspace(0,50,1000)
n = 5
L = 50
t = 0
def gyroid(x, y, n, L, t):
tanım1 = (sin(2*pi*n*x/L) * cos(2*pi*n*y/L) + sin(2*pi*n*y/L) + cos(2*pi*n*x/L))
return tanım1*tanım1 - t**2
XX, YY = meshgrid(x, y)
z = gyroid(XX, YY, n, L, t)
thickness = 0.1
contour = plt.contour(XX, YY, z,levels=[thickness])
# Attempt to get x-y coordinates
dat0= contour.allsegs[0][0]
plt.plot(dat0[:,0],dat0[:,1])
陀螺儀 function 通常看起來像; 3D plot
我得到 z = 0.1 平面的等值線; 無效 plot
我需要 xy 對這些空隙。 但是當我嘗試時,代碼只會得到左下角的坐標。 顯然 function 是強非線性的,但是有沒有辦法檢索這些坐標?
提前感謝您的回復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.