File tree Expand file tree Collapse file tree 2 files changed +44
-4
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +44
-4
lines changed
Original file line number Diff line number Diff line change @@ -1114,13 +1114,46 @@ def matchfunc(x):
1114
1114
1115
1115
def get_cursor_data (self , event ):
1116
1116
"""
1117
- Get the cursor data for a given event.
1117
+ Return the cursor data for a given event.
1118
+
1119
+ .. note::
1120
+ This method is intended to be overridden by artist subclasses
1121
+ (or monkeypatched). As an end-user of Matplotlib you will most
1122
+ likely not call this method yourself.
1123
+
1124
+ Cursor data can be used by Artists to provide additional context
1125
+ information for a given event. The default implementation just returns
1126
+ *None*.
1127
+
1128
+ Subclasses can override the method and return arbitrary data. However,
1129
+ when doing so, they must ensure that `.format_cursor_data` can convert
1130
+ the data to a string representation.
1131
+
1132
+ The only current use case is displaying the z-value of an `.AxesImage`
1133
+ in the status bar of a plot window, while moving the mouse.
1134
+
1135
+ See Also
1136
+ --------
1137
+ format_cursor_data
1138
+
1118
1139
"""
1119
1140
return None
1120
1141
1121
1142
def format_cursor_data (self , data ):
1122
1143
"""
1123
- Return *cursor data* string formatted.
1144
+ Return a string representation of *data*.
1145
+
1146
+ .. note::
1147
+ This method is intended to be overridden by artist subclasses
1148
+ (or monkeypatched). As an end-user of Matplotlib you will most
1149
+ likely not call this method yourself.
1150
+
1151
+ The default implementation converts ints and floats and arrays of ints
1152
+ and floats into a comma-separated string enclosed in square brackets.
1153
+
1154
+ See Also
1155
+ --------
1156
+ get_cursor_data
1124
1157
"""
1125
1158
try :
1126
1159
data [0 ]
Original file line number Diff line number Diff line change @@ -881,7 +881,14 @@ def get_extent(self):
881
881
return (- 0.5 , numcols - 0.5 , - 0.5 , numrows - 0.5 )
882
882
883
883
def get_cursor_data (self , event ):
884
- """Get the cursor data for a given event"""
884
+ """
885
+ Return the image value at the event position or *None* if the event is
886
+ outside the image.
887
+
888
+ See Also
889
+ --------
890
+ matplotlib.artist.Artist.get_cursor_data
891
+ """
885
892
xmin , xmax , ymin , ymax = self .get_extent ()
886
893
if self .origin == 'upper' :
887
894
ymin , ymax = ymax , ymin
@@ -1142,7 +1149,7 @@ def set_array(self, *args):
1142
1149
raise NotImplementedError ('Method not supported' )
1143
1150
1144
1151
def get_cursor_data (self , event ):
1145
- """Get the cursor data for a given event"""
1152
+ # docstring inherited
1146
1153
x , y = event .xdata , event .ydata
1147
1154
if (x < self ._Ax [0 ] or x > self ._Ax [- 1 ] or
1148
1155
y < self ._Ay [0 ] or y > self ._Ay [- 1 ]):
You can’t perform that action at this time.
0 commit comments