1
Figureからポイントを選んで描画し、それらのコーディネーションを配列に格納したいと思います。それは可能ですか?はいの場合は、私を案内してくれて、助けてくれてありがとう。イベント処理matplotlip python
私はこの例を持っているが、それはラインを描いている。
from matplotlib import pyplot as plt
class LineBuilder:
def __init__(self, line):
self.line = line
self.xs = list(line.get_xdata())
self.ys = list(line.get_ydata())
self.cid = line.figure.canvas.mpl_connect('button_press_event', self)
def __call__(self, event):
print('click', event)
if event.inaxes!=self.line.axes: return
self.xs.append(event.xdata)
self.ys.append(event.ydata)
self.line.set_data(self.xs, self.ys)
self.line.figure.canvas.draw()
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('click to build line segments')
line, = ax.plot([0], [0]) # empty line
linebuilder = LineBuilder(line)
plt.show()
は、私は:) –
グレート探しているものを、この場合には、あなたが(https://meta.stackexchange.com/questions/5234/ [受け入れる]ことをお願いします答えを受け入れる - ) - その答え。 SOが一般的にどのように機能しているかを確認するには、[ツアー]を利用することもできます。 – ImportanceOfBeingErnest