@@ -160,25 +160,23 @@ def open_group(self, s, gid=None):
160
160
161
161
def close_group (self , s ):
162
162
"""
163
- Close a grouping element with label *s*
163
+ Close a grouping element with label *s*.
164
164
165
165
Only used by the SVG renderer.
166
166
"""
167
167
168
168
def draw_path (self , gc , path , transform , rgbFace = None ):
169
- """
170
- Draws a :class:`~matplotlib.path.Path` instance using the
171
- given affine transform.
172
- """
169
+ """Draw a `~.path.Path` instance using the given affine transform."""
173
170
raise NotImplementedError
174
171
175
172
def draw_markers (self , gc , marker_path , marker_trans , path ,
176
173
trans , rgbFace = None ):
177
174
"""
178
- Draws a marker at each of the vertices in path. This includes
179
- all vertices, including control points on curves. To avoid
180
- that behavior, those vertices should be removed before calling
181
- this function.
175
+ Draw a marker at each of the vertices in path.
176
+
177
+ This includes all vertices, including control points on curves.
178
+ To avoid that behavior, those vertices should be removed before
179
+ calling this function.
182
180
183
181
This provides a fallback implementation of draw_markers that
184
182
makes multiple calls to :meth:`draw_path`. Some backends may
@@ -188,7 +186,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path,
188
186
Parameters
189
187
----------
190
188
gc : `GraphicsContextBase`
191
- The graphics context
189
+ The graphics context.
192
190
193
191
marker_trans : `matplotlib.transforms.Transform`
194
192
An affine transform applied to the marker.
@@ -210,7 +208,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
210
208
linewidths , linestyles , antialiaseds , urls ,
211
209
offset_position ):
212
210
"""
213
- Draws a collection of paths selecting drawing properties from
211
+ Draw a collection of paths selecting drawing properties from
214
212
the lists *facecolors*, *edgecolors*, *linewidths*,
215
213
*linestyles* and *antialiaseds*. *offsets* is a list of
216
214
offsets to apply to each of the paths. The offsets in
@@ -286,7 +284,7 @@ def draw_gouraud_triangle(self, gc, points, colors, transform):
286
284
def draw_gouraud_triangles (self , gc , triangles_array , colors_array ,
287
285
transform ):
288
286
"""
289
- Draws a series of Gouraud triangles.
287
+ Draw a series of Gouraud triangles.
290
288
291
289
Parameters
292
290
----------
@@ -1680,15 +1678,17 @@ def draw_event(self, renderer):
1680
1678
self .callbacks .process (s , event )
1681
1679
1682
1680
def resize_event (self ):
1683
- """Pass a `ResizeEvent` to all functions connected to ``resize_event``.
1681
+ """
1682
+ Pass a `ResizeEvent` to all functions connected to ``resize_event``.
1684
1683
"""
1685
1684
s = 'resize_event'
1686
1685
event = ResizeEvent (s , self )
1687
1686
self .callbacks .process (s , event )
1688
1687
self .draw_idle ()
1689
1688
1690
1689
def close_event (self , guiEvent = None ):
1691
- """Pass a `CloseEvent` to all functions connected to ``close_event``.
1690
+ """
1691
+ Pass a `CloseEvent` to all functions connected to ``close_event``.
1692
1692
"""
1693
1693
s = 'close_event'
1694
1694
try :
@@ -1703,7 +1703,8 @@ def close_event(self, guiEvent=None):
1703
1703
# with an open window; 'callbacks' attribute no longer exists.
1704
1704
1705
1705
def key_press_event (self , key , guiEvent = None ):
1706
- """Pass a `KeyEvent` to all functions connected to ``key_press_event``.
1706
+ """
1707
+ Pass a `KeyEvent` to all functions connected to ``key_press_event``.
1707
1708
"""
1708
1709
self ._key = key
1709
1710
s = 'key_press_event'
@@ -1942,15 +1943,17 @@ def get_width_height(self):
1942
1943
1943
1944
@classmethod
1944
1945
def get_supported_filetypes (cls ):
1945
- """Return dict of savefig file formats supported by this backend"""
1946
+ """Return dict of savefig file formats supported by this backend. """
1946
1947
return cls .filetypes
1947
1948
1948
1949
@classmethod
1949
1950
def get_supported_filetypes_grouped (cls ):
1950
- """Return a dict of savefig file formats supported by this backend,
1951
+ """
1952
+ Return a dict of savefig file formats supported by this backend,
1951
1953
where the keys are a file type name, such as 'Joint Photographic
1952
1954
Experts Group', and the values are a list of filename extensions used
1953
- for that filetype, such as ['jpg', 'jpeg']."""
1955
+ for that filetype, such as ['jpg', 'jpeg'].
1956
+ """
1954
1957
groupings = {}
1955
1958
for ext , name in cls .filetypes .items ():
1956
1959
groupings .setdefault (name , []).append (ext )
@@ -2248,7 +2251,8 @@ def flush_events(self):
2248
2251
"""
2249
2252
2250
2253
def start_event_loop (self , timeout = 0 ):
2251
- """Start a blocking event loop.
2254
+ """
2255
+ Start a blocking event loop.
2252
2256
2253
2257
Such an event loop is used by interactive functions, such as `ginput`
2254
2258
and `waitforbuttonpress`, to wait for events.
@@ -2274,7 +2278,8 @@ def start_event_loop(self, timeout=0):
2274
2278
counter += 1
2275
2279
2276
2280
def stop_event_loop (self ):
2277
- """Stop the current blocking event loop.
2281
+ """
2282
+ Stop the current blocking event loop.
2278
2283
2279
2284
Interactive backends need to reimplement this to match
2280
2285
`start_event_loop`
@@ -2550,14 +2555,16 @@ def button_press(self, event):
2550
2555
button_press_handler (event , self .canvas , self .canvas .toolbar )
2551
2556
2552
2557
def get_window_title (self ):
2553
- """Get the title text of the window containing the figure.
2558
+ """
2559
+ Get the title text of the window containing the figure.
2554
2560
2555
2561
Return None for non-GUI (e.g., PS) backends.
2556
2562
"""
2557
2563
return 'image'
2558
2564
2559
2565
def set_window_title (self , title ):
2560
- """Set the title text of the window containing the figure.
2566
+ """
2567
+ Set the title text of the window containing the figure.
2561
2568
2562
2569
This has no effect for non-GUI (e.g., PS) backends.
2563
2570
"""
@@ -2652,13 +2659,14 @@ def set_message(self, s):
2652
2659
"""Display a message on toolbar or in status bar."""
2653
2660
2654
2661
def back (self , * args ):
2655
- """move back up the view lim stack"""
2662
+ """Move back up the view lim stack. """
2656
2663
self ._nav_stack .back ()
2657
2664
self .set_history_buttons ()
2658
2665
self ._update_view ()
2659
2666
2660
2667
def draw_rubberband (self , event , x0 , y0 , x1 , y1 ):
2661
- """Draw a rectangle rubberband to indicate zoom limits.
2668
+ """
2669
+ Draw a rectangle rubberband to indicate zoom limits.
2662
2670
2663
2671
Note that it is not guaranteed that ``x0 <= x1`` and ``y0 <= y1``.
2664
2672
"""
@@ -2770,7 +2778,11 @@ def mouse_move(self, event):
2770
2778
self .set_message (self .mode )
2771
2779
2772
2780
def pan (self , * args ):
2773
- """Activate the pan/zoom tool. pan with left button, zoom with right"""
2781
+ """
2782
+ Activate the pan/zoom tool.
2783
+
2784
+ Pan with left button, zoom with right.
2785
+ """
2774
2786
# set the pointer icon and button press funcs to the
2775
2787
# appropriate callbacks
2776
2788
@@ -3010,8 +3022,9 @@ def draw(self):
3010
3022
self .canvas .draw_idle ()
3011
3023
3012
3024
def _update_view (self ):
3013
- """Update the viewlim and position from the view and
3014
- position stack for each axes.
3025
+ """
3026
+ Update the viewlim and position from the view and position stack for
3027
+ each axes.
3015
3028
"""
3016
3029
nav_info = self ._nav_stack ()
3017
3030
if nav_info is None :
@@ -3031,7 +3044,8 @@ def save_figure(self, *args):
3031
3044
raise NotImplementedError
3032
3045
3033
3046
def set_cursor (self , cursor ):
3034
- """Set the current cursor to one of the :class:`Cursors` enums values.
3047
+ """
3048
+ Set the current cursor to one of the :class:`Cursors` enums values.
3035
3049
3036
3050
If required by the backend, this method should trigger an update in
3037
3051
the backend event loop after the cursor is set, as this method may be
@@ -3208,39 +3222,39 @@ def toggle_toolitem(self, name, toggled):
3208
3222
3209
3223
def remove_toolitem (self , name ):
3210
3224
"""
3211
- Remove a toolitem from the `ToolContainer`
3225
+ Remove a toolitem from the `ToolContainer`.
3212
3226
3213
- This method must get implemented per backend
3227
+ This method must get implemented per backend.
3214
3228
3215
- Called when `ToolManager` emits a `tool_removed_event`
3229
+ Called when `ToolManager` emits a `tool_removed_event`.
3216
3230
3217
3231
Parameters
3218
3232
----------
3219
3233
name : string
3220
- Name of the tool to remove
3234
+ Name of the tool to remove.
3221
3235
"""
3222
3236
raise NotImplementedError
3223
3237
3224
3238
3225
3239
class StatusbarBase :
3226
- """Base class for the statusbar"""
3240
+ """Base class for the statusbar. """
3227
3241
def __init__ (self , toolmanager ):
3228
3242
self .toolmanager = toolmanager
3229
3243
self .toolmanager .toolmanager_connect ('tool_message_event' ,
3230
3244
self ._message_cbk )
3231
3245
3232
3246
def _message_cbk (self , event ):
3233
- """Captures the 'tool_message_event' and set the message"""
3247
+ """Capture the 'tool_message_event' and set the message. """
3234
3248
self .set_message (event .message )
3235
3249
3236
3250
def set_message (self , s ):
3237
3251
"""
3238
- Display a message on toolbar or in status bar
3252
+ Display a message on toolbar or in status bar.
3239
3253
3240
3254
Parameters
3241
3255
----------
3242
3256
s : str
3243
- Message text
3257
+ Message text.
3244
3258
"""
3245
3259
pass
3246
3260
@@ -3278,8 +3292,7 @@ class _Backend:
3278
3292
3279
3293
@classmethod
3280
3294
def new_figure_manager (cls , num , * args , ** kwargs ):
3281
- """Create a new figure manager instance.
3282
- """
3295
+ """Create a new figure manager instance."""
3283
3296
# This import needs to happen here due to circular imports.
3284
3297
from matplotlib .figure import Figure
3285
3298
fig_cls = kwargs .pop ('FigureClass' , Figure )
@@ -3288,8 +3301,7 @@ def new_figure_manager(cls, num, *args, **kwargs):
3288
3301
3289
3302
@classmethod
3290
3303
def new_figure_manager_given_figure (cls , num , figure ):
3291
- """Create a new figure manager instance for the given figure.
3292
- """
3304
+ """Create a new figure manager instance for the given figure."""
3293
3305
<
1241
td data-grid-cell-id="diff-c21fb96269cbb9b214edf0c22981b347d8b710abaad167da678242ce8a539bb2-3293-3305-2" data-line-anchor="diff-c21fb96269cbb9b214edf0c22981b347d8b710abaad167da678242ce8a539bb2R3305" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side"> canvas = cls .FigureCanvas (figure )
3294
3306
manager = cls .FigureManager (canvas , num )
3295
3307
return manager
0 commit comments