背景
the documentation example hereから、コードスニペットで以下の等高線図を簡単に作成できます。matplotlibの輪郭から座標を取得しますか?
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)
# Create a simple contour plot with labels using default colors. The
# inline argument to clabel will control whether the labels are draw
# over the line segments of the contour, removing the lines beneath
# the label
plt.figure()
CS = plt.contour(X, Y, Z)
plt.clabel(CS, inline=1, fontsize=10)
plt.title('Simplest default with labels')
私の目標
私は私の等高線図を入手し、その間matplotlib.contour.QuadContourSet
インスタンスCS
を持っています。このスニペットの例ではCS
はclabel()
でのみ使用されています。しかし、私の場合は、私は等高線の方程式か、それ以上の計算のための座標を求める必要があります。
CS
から等高線の座標を抽出するにはどうすればよいですか? OR どうすれば他の方法で達成できますか?
私はそうする方法があるはずです。さもなければ、輪郭物は単に「視覚化の花瓶」に過ぎない。
http://scikit-image.org/docs/dev/auto_examples/plot_contours.html – tacaswell