@@ -764,7 +764,7 @@ def get_alpha(self):
764
764
return self ._alpha
765
765
766
766
def get_antialiased (self ):
767
- "Return whether the object should try to do antialiased rendering."
767
+ """ Return whether the object should try to do antialiased rendering."" "
768
768
return self ._antialiased
769
769
770
770
def get_capstyle (self ):
@@ -1434,7 +1434,7 @@ def __str__(self):
1434
1434
1435
1435
class PickEvent (Event ):
1436
1436
"""
1437
- a pick event, fired when the user picks a location on the canvas
1437
+ A pick event, fired when the user picks a location on the canvas
1438
1438
sufficiently close to an artist.
1439
1439
1440
1440
Attrs: all the :class:`Event` attributes plus
@@ -1455,7 +1455,9 @@ class PickEvent(Event):
1455
1455
1456
1456
Examples
1457
1457
--------
1458
- ::
1458
+ Bind a function ``on_pick()`` to pick events, that prints the coordinates
1459
+ of the picked data point::
1460
+
1459
1461
ax.plot(np.rand(100), 'o', picker=5) # 5 points tolerance
1460
1462
1461
1463
def on_pick(event):
@@ -1551,8 +1553,6 @@ class FigureCanvasBase:
1551
1553
"""
1552
1554
The canvas the figure renders into.
1553
1555
1554
- Public attributes
1555
-
1556
1556
Attributes
1557
1557
----------
1558
1558
figure : `matplotlib.figure.Figure`
@@ -1643,7 +1643,7 @@ def _idle_draw_cntx(self):
1643
1643
1644
1644
def is_saving (self ):
1645
1645
"""
1646
- Returns whether the renderer is in the process of saving
1646
+ Return whether the renderer is in the process of saving
1647
1647
to a file, rather than rendering for an on-screen buffer.
1648
1648
"""
1649
1649
return self ._is_saving
@@ -1711,8 +1711,10 @@ def key_release_event(self, key, guiEvent=None):
1711
1711
1712
1712
def pick_event (self , mouseevent , artist , ** kwargs ):
1713
1713
"""
1714
+ Callback processing for pick events.
1715
+
1714
1716
This method will be called by artists who are picked and will
1715
- fire off :class:`PickEvent` callbacks registered listeners
1717
+ fire off :class:`PickEvent` callbacks registered listeners.
1716
1718
"""
1717
1719
s = 'pick_event'
1718
1720
event = PickEvent (s , self , mouseevent , artist ,
@@ -1722,6 +1724,8 @@ def pick_event(self, mouseevent, artist, **kwargs):
1722
1724
1723
1725
def scroll_event (self , x , y , step , guiEvent = None ):
1724
1726
"""
1727
+ Callback processing for scroll events.
1728
+
1725
1729
Backend derived classes should call this function on any
1726
1730
scroll wheel event. (*x*, *y*) are the canvas coords ((0, 0) is lower
1727
1731
left). button and key are as defined in MouseEvent.
@@ -1740,6 +1744,8 @@ def scroll_event(self, x, y, step, guiEvent=None):
1740
1744
1741
1745
def button_press_event (self , x , y , button , dblclick = False , guiEvent = None ):
1742
1746
"""
1747
+ Callback processing for mouse button press events.
1748
+
1743
1749
Backend derived classes should call this function on any mouse
1744
1750
button press. (*x*, *y*) are the canvas coords ((0, 0) is lower left).
1745
1751
button and key are as defined in :class:`MouseEvent`.
@@ -1755,6 +1761,8 @@ def button_press_event(self, x, y, button, dblclick=False, guiEvent=None):
1755
1761
1756
1762
def button_release_event (self , x , y , button , guiEvent = None ):
1757
1763
"""
1764
+ Callback processing for mouse button release events.
1765
+
1758
1766
Backend derived classes should call this function on any mouse
1759
1767
button release.
1760
1768
@@ -1777,6 +1785,8 @@ def button_release_event(self, x, y, button, guiEvent=None):
1777
1785
1778
1786
def motion_notify_event (self , x , y , guiEvent = None ):
1779
1787
"""
1788
+ Callback processing for mouse movement events.
1789
+
1780
1790
Backend derived classes should call this function on any
1781
1791
motion-notify-event.
1782
1792
@@ -1800,8 +1810,10 @@ def motion_notify_event(self, x, y, guiEvent=None):
1800
1810
1801
1811
def leave_notify_event (self , guiEvent = None ):
1802
1812
"""
1813
+ Callback processing for the mouse cursor leaving the canvas.
1814
+
1803
1815
Backend derived classes should call this function when leaving
1804
- canvas
1816
+ canvas.
1805
1817
1806
1818
Parameters
1807
1819
----------
@@ -1814,8 +1826,10 @@ def leave_notify_event(self, guiEvent=None):
1814
1826
1815
1827
def enter_notify_event (self , guiEvent = None , xy = None ):
1816
1828
"""
1829
+ Callback processing for the mouse cursor entering the canvas.
1830
+
1817
1831
Backend derived classes should call this function when entering
1818
- canvas
1832
+ canvas.
1819
1833
1820
1834
Parameters
1821
1835
----------
@@ -1839,19 +1853,17 @@ def enter_notify_event(self, guiEvent=None, xy=None):
1839
1853
1840
1854
def inaxes (self , xy ):
1841
1855
"""
1842
- Check if a point is in an axes .
1856
+ Return the topmost `~.axes.Axes` containing the point *xy* .
1843
1857
1844
1858
Parameters
1845
1859
----------
1846
- xy : tuple or list
1847
- (x, y) coordinates.
1848
- x position - pixels from left of canvas.
1849
- y position - pixels from bottom of canvas.
1860
+ xy : (float, float)
1861
+ (x, y) pixel positions from left/bottom of the canvas.
1850
1862
1851
1863
Returns
1852
1864
-------
1853
- axes: topmost axes containing the point, or None if no axes.
1854
-
1865
+ axes : `~matplotlib. axes.Axes` or None
1866
+ The topmost axes containing the point, or None if no axes.
1855
1867
"""
1856
1868
axes_list = [a for a in self .figure .get_axes ()
1857
1869
if a .patch .contains_point (xy )]
@@ -1865,21 +1877,21 @@ def inaxes(self, xy):
1865
1877
1866
1878
def grab_mouse (self , ax ):
1867
1879
"""
1868
- Set the child axes which are currently grabbing the mouse events.
1869
- Usually called by the widgets themselves.
1870
- It is an error to call this if the mouse is already grabbed by
1871
- another axes.
1880
+ Set the child `~. axes.Axes` which is grabbing the mouse events.
1881
+
1882
+ Usually called by the widgets themselves. It is an error to call this
1883
+ if the mouse is already grabbed by another axes.
1872
1884
"""
1873
1885
if self .mouse_grabber not in (None , ax ):
1874
1886
raise RuntimeError ("Another Axes already grabs mouse input" )
1875
1887
self .mouse_grabber = ax
1876
1888
1877
1889
def release_mouse (self , ax ):
1878
1890
"""
1879
- Release the mouse grab held by the axes, ax .
1880
- Usually called by the widgets.
1881
- It is ok to call this even if you ax doesn't have the mouse
1882
- grab currently.
1891
+ Release the mouse grab held by the `~. axes.Axes` *ax* .
1892
+
1893
+ Usually called by the widgets. It is ok to call this even if *ax*
1894
+ doesn't have the mouse grab currently.
1883
1895
"""
1884
1896
if self .mouse_grabber is ax :
1885
1897
self .mouse_grabber = None
@@ -1914,7 +1926,7 @@ def draw_cursor(self, event):
1914
1926
def get_width_height (self ):
1915
1927
"""
1916
1928
Return the figure width and height in points or pixels
1917
- (depending on the backend), truncated to integers
1929
+ (depending on the backend), truncated to integers.
1918
1930
"""
1919
1931
return int (self .figure .bbox .width ), int (self .figure .bbox .height )
1920
1932
@@ -2110,16 +2122,18 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
2110
2122
@classmethod
2111
2123
def get_default_filetype (cls ):
2112
2124
"""
2113
- Get the default savefig file format as specified in
2114
- :rc:`savefig.format`. Returned string excludes period. Overridden
2115
- in backends that only support a single file type.
2125
+ Return the default savefig file format as specified in
2126
+ :rc:`savefig.format`.
2127
+
2128
+ The returned string does not include a period. This method is
2129
+ overridden in backends that only support a single file type.
2116
2130
"""
2117
2131
return rcParams ['savefig.format' ]
2118
2132
2119
2133
def get_window_title (self ):
2120
2134
"""
2121
- Get the title text of the window containing the figure.
2122
- Return None if there is no window (e.g., a PS backend).
2135
+ Return the title text of the window containing the figure, or None
2136
+ if there is no window (e.g., a PS backend).
2123
2137
"""
2124
2138
if self .manager :
2125
2139
return self .manager .get_window_title ()
@@ -2594,9 +2608,8 @@ def button_press(self, event):
2594
2608
2595
2609
def get_window_title (self ):
2596
2610
"""
2597
- Get the title text of the window containing the figure.
2598
-
2599
- Return None for non-GUI (e.g., PS) backends.
2611
+ Return the title text of the window containing the figure, or None
2612
+ if there is no window (e.g., a PS backend).
2600
2613
"""
2601
2614
return 'image'
2602
2615
@@ -3154,15 +3167,15 @@ def __init__(self, toolmanager):
3154
3167
3155
3168
def _tool_toggled_cbk (self , event ):
3156
3169
"""
3157
- Captures the 'tool_trigger_[name]'
3170
+ Capture the 'tool_trigger_[name]'
3158
3171
3159
- This only gets used for toggled tools
3172
+ This only gets used for toggled tools.
3160
3173
"""
3161
3174
self .toggle_toolitem (event .tool .name , event .tool .toggled )
3162
3175
3163
3176
def add_tool (self , tool , group , position = - 1 ):
3164
3177
"""
3165
- Adds a tool to this container
3178
+ Add a tool to this container.
3166
3179
3167
3180
Parameters
3168
3181
----------
@@ -3186,7 +3199,7 @@ def add_tool(self, tool, group, position=-1):
3186
3199
self .toggle_toolitem (tool .name , True )
3187
3200
3188
3201
def _remove_tool_cbk (self , event ):
3189
- """Captures the 'tool_removed_event' signal and removes the tool."""
3202
+ """Capture the 'tool_removed_event' signal and removes the tool."""
3190
3203
self .remove_toolitem (event .tool .name )
3191
3204
3192
3205
def _get_image_filename (self , image ):
@@ -3206,7 +3219,7 @@ def _get_image_filename(self, image):
3206
3219
3207
3220
def trigger_tool (self , name ):
3208
3221
"""
3209
- Trigger the tool
3222
+ Trigger the tool.
3210
3223
3211
3224
Parameters
3212
3225
----------
@@ -3217,42 +3230,42 @@ def trigger_tool(self, name):
3217
3230
3218
3231
def add_toolitem (self , name , group , position , image , description , toggle ):
3219
3232
"""
3220
- Add a toolitem to the container
3233
+ Add a toolitem to the container.
3221
3234
3222
- This method must get implemented per backend
3235
+ This method must be implemented per backend.
3223
3236
3224
3237
The callback associated with the button click event,
3225
- must be **EXACTLY** ` self.trigger_tool(name)`
3238
+ must be *exactly* `` self.trigger_tool(name)``.
3226
3239
3227
3240
Parameters
3228
3241
----------
3229
3242
name : str
3230
3243
Name of the tool to add, this gets used as the tool's ID and as the
3231
- default label of the buttons
3232
- group : String
3233
- Name of the group that this tool belongs to
3234
- position : Int
3235
- Position of the tool within its group, if -1 it goes at the End
3236
- image_file : String
3237
- Filename of the image for the button or `None`
3238
- description : String
3239
- Description of the tool, used for the tooltips
3240
- toggle : Bool
3244
+ default label of the buttons.
3245
+ group : str
3246
+ Name of the group that this tool belongs to.
3247
+ position : int
3248
+ Position of the tool within its group, if -1 it goes at the end.
3249
+ image_file : str
3250
+ Filename of the image for the button or `None`.
3251
+ description : str
3252
+ Description of the tool, used for the tooltips.
3253
+ toggle : bool
3241
3254
* `True` : The button is a toggle (change the pressed/unpressed
3242
- state between consecutive clicks)
3255
+ state between consecutive clicks).
3243
3256
* `False` : The button is a normal button (returns to unpressed
3244
- state after release)
3257
+ state after release).
3245
3258
"""
3246
3259
raise NotImplementedError
3247
3260
3248
3261
def toggle_toolitem (self , name , toggled ):
3249
3262
"""
3250
- Toggle the toolitem without firing event
3263
+ Toggle the toolitem without firing event.
3251
3264
3252
3265
Parameters
3253
3266
----------
3254
- name : String
3255
- Id of the tool to toggle
3267
+ name : str
3268
+ Id of the tool to toggle.
3256
3269
toggled : bool
3257
3270
Whether to set this tool as toggled or not.
3258
3271
"""
0 commit comments