Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf10d0d1

Browse files
authored
Merge pull request#25106 from anntzer/cd
Fix cursor_demo wrt. Line2D.set_x/ydata not accepting scalars anymore.
2 parents546b9fc +02fb7e0 commitf10d0d1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎examples/event_handling/cursor_demo.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def on_mouse_move(self, event):
5656
self.set_cross_hair_visible(True)
5757
x,y=event.xdata,event.ydata
5858
# update the line positions
59-
self.horizontal_line.set_ydata(y)
60-
self.vertical_line.set_xdata(x)
59+
self.horizontal_line.set_ydata([y])
60+
self.vertical_line.set_xdata([x])
6161
self.text.set_text(f'x={x:1.2f}, y={y:1.2f}')
6262
self.ax.figure.canvas.draw()
6363

@@ -132,8 +132,8 @@ def on_mouse_move(self, event):
132132
self.set_cross_hair_visible(True)
133133
# update the line positions
134134
x,y=event.xdata,event.ydata
135-
self.horizontal_line.set_ydata(y)
136-
self.vertical_line.set_xdata(x)
135+
self.horizontal_line.set_ydata([y])
136+
self.vertical_line.set_xdata([x])
137137
self.text.set_text(f'x={x:1.2f}, y={y:1.2f}')
138138

139139
self.ax.figure.canvas.restore_region(self.background)
@@ -204,8 +204,8 @@ def on_mouse_move(self, event):
204204
x=self.x[index]
205205
y=self.y[index]
206206
# update the line positions
207-
self.horizontal_line.set_ydata(y)
208-
self.vertical_line.set_xdata(x)
207+
self.horizontal_line.set_ydata([y])
208+
self.vertical_line.set_xdata([x])
209209
self.text.set_text(f'x={x:1.2f}, y={y:1.2f}')
210210
self.ax.figure.canvas.draw()
211211

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp