8000 DOC: Add correct headings for backend files. · matplotlib/matplotlib@8944735 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8944735

Browse files
committed
DOC: Add correct headings for backend files.
1 parent 75e8410 commit 8944735

15 files changed

+390
-248
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 157 additions & 102 deletions
Large diffs are not rendered by default.

lib/matplotlib/backends/backend_agg.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,11 @@ class FigureCanvasAgg(FigureCanvasBase):
437437
The canvas the figure renders into. Calls the draw and print fig
438438
methods, creates the renderers, etc...
439439
440-
Public attribute
440+
Attributes
441+
----------
442+
figure
443+
A Figure instance
441444
442-
figure - A Figure instance
443445
"""
444446

445447
def copy_from_bbox(self, bbox):
@@ -575,19 +577,22 @@ def print_to_buffer(self):
575577
# add JPEG support
576578
def print_jpg(self, filename_or_obj, *args, **kwargs):
577579
"""
578-
Supported kwargs:
579-
580-
*quality*: The image quality, on a scale from 1 (worst) to
580+
Keyword Args
581+
------------
582+
quality: int
583+
The image quality, on a scale from 1 (worst) to
581584
95 (best). The default is 95, if not given in the
582585
matplotlibrc file in the savefig.jpeg_quality parameter.
583586
Values above 95 should be avoided; 100 completely
584587
disables the JPEG quantization stage.
585588
586-
*optimize*: If present, indicates that the encoder should
589+
optimize: bool
590+
If present, indicates that the encoder should
587591
make an extra pass over the image in order to select
588592
optimal encoder settings.
589593
590-
*progressive*: If present, indicates that this image
594+
progressive: bool
595+
If present, indicates that this image
591596
should be stored as a progressive JPEG file.
592597
"""
593598
buf, size = self.print_to_buffer()

lib/matplotlib/backends/backend_gtk.py

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,20 @@ def new_figure_manager_given_figure(num, figure):
104104

105105
class TimerGTK(TimerBase):
106106
'''
107-
Subclass of :class:`backend_bases.TimerBase` that uses GTK for timer events.
108-
109-
Attributes:
110-
* interval: The time between timer events in milliseconds. Default
111-
is 1000 ms.
112-
* single_shot: Boolean flag indicating whether this timer should
113-
operate as single shot (run once and then stop). Defaults to False.
114-
* callbacks: Stores list of (func, args) tuples that will be called
115-
upon timer events. This list can be manipulated directly, or the
116-
functions add_callback and remove_callback can be used.
107+
Subclass of :class:`backend_bases.TimerBase` using GTK for timer events.
108+
109+
Attributes
110+
----------
111+
interval: int
112+
The time between timer events in milliseconds. Default is 1000 ms.
113+
single_shot: bool
114+
Boolean flag indicating whether this timer should operate as single
115+
shot (run once and then stop). Defaults to False.
116+
callbacks: list
117+
Stores list of (func, args) tuples that will be called upon timer
118+
events. This list can be manipulated directly, or the functions
119+
`add_callback` and `remove_callback` can be used.
120+
117121
'''
118122
def _timer_start(self):
119123
# Need to stop it, otherwise we potentially leak a timer id that will
@@ -510,12 +514,12 @@ def new_timer(self, *args, **kwargs):
510514
This is useful for getting periodic events through the backend's native
511515
event loop. Implemented only for backends with GUIs.
512516
513-
optional arguments:
514-
515-
*interval*
517+
Keyword Arguments
518+
-----------------
519+
interval
516520
Timer interval in milliseconds
517-
*callbacks*
518-
Sequence of (func, args, kwargs) where func(*args, **kwargs) will
521+
callbacks
522+
Sequence of (func, args, kwargs) where func(\*args, \*\*kwargs) will
519523
be executed by the timer every *interval*.
520524
"""
521525
return TimerGTK(*args, **kwargs)
@@ -537,13 +541,19 @@ def stop_event_loop(self):
537541

538542
class FigureManagerGTK(FigureManagerBase):
539543
"""
540-
Public attributes
544+
Attributes
545+
----------
546+
canvas
547+
The FigureCanvas instance
548+
num
549+
The Figure number
550+
toolbar
551+
The gtk.Toolbar (gtk only)
552+
vbox
553+
The gtk.VBox containing the canvas and toolbar (gtk only)
554+
window
555+
The gtk.Window (gtk only)
541556
542-
canvas : The FigureCanvas instance
543-
num : The Figure number
544-
toolbar : The gtk.Toolbar (gtk only)
545-
vbox : The gtk.VBox containing the canvas and toolbar (gtk only)
546-
window : The gtk.Window (gtk only)
547557
"""
548558
def __init__(self, canvas, num):
549559
if _debug: print('FigureManagerGTK.%s' % fn_name())

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,20 @@ def mainloop(self):
7676

7777
class TimerGTK3(TimerBase):
7878
'''
79-
Subclass of :class:`backend_bases.TimerBase` that uses GTK3 for timer events.
80-
81-
Attributes:
82-
* interval: The time between timer events in milliseconds. Default
83-
is 1000 ms.
84-
* single_shot: Boolean flag indicating whether this timer should
85-
operate as single shot (run once and then stop). Defaults to False.
86-
* callbacks: Stores list of (func, args) tuples that will be called
87-
upon timer events. This list can be manipulated directly, or the
88-
functions add_callback and remove_callback can be used.
79+
Subclass of :class:`backend_bases.TimerBase` using GTK3 for timer events.
80+
81+
Attributes
82+
----------
83+
interval: int
84+
The time between timer events in milliseconds. Default is 1000 ms.
85+
single_shot: bool
86+
Boolean flag indicating whether this timer should operate as single
87+
shot (run once and then stop). Defaults to False.
88+
callbacks: list
89+
Stores list of (func, args) tuples that will be called upon timer
90+
events. This list can be manipulated directly, or the functions
91+
`add_callback` and `remove_callback` can be used.
92+
8993
'''
9094
def _timer_start(self):
9195
# Need to stop it, otherwise we potentially leak a timer id that will
@@ -348,12 +352,12 @@ def new_timer(self, *args, **kwargs):
348352
This is useful for getting periodic events through the backend's native
349353
event loop. Implemented only for backends with GUIs.
350354
351-
optional arguments:
352-
353-
*interval*
355+
Keyword Arguments
356+
-----------------
357+
interval
354358
Timer interval in milliseconds
355-
*callbacks*
356-
Sequence of (func, args, kwargs) where func(*args, **kwargs) will
359+
callbacks
360+
Sequence of (func, args, kwargs) where func(\*args, \*\*kwargs) will
357361
be executed by the timer every *interval*.
358362
"""
359363
return TimerGTK3(*args, **kwargs)
@@ -376,13 +380,19 @@ def stop_event_loop(self):
376380

377381
class FigureManagerGTK3(FigureManagerBase):
378382
"""
379-
Public attributes
383+
Attributes
384+
----------
385+
canvas
386+
The FigureCanvas instance
387+
num
388+
The Figure number
389+
toolbar
390+
The Gtk.Toolbar (gtk only)
391+
vbox
392+
The Gtk.VBox containing the canvas and toolbar (gtk only)
393+
window
394+
The Gtk.Window (gtk only)
380395
381-
canvas : The FigureCanvas instance
382-
num : The Figure number
383-
toolbar : The Gtk.Toolbar (gtk only)
384-
vbox : The Gtk.VBox containing the canvas and toolbar (gtk only)
385-
window : The Gtk.Window (gtk only)
386396
"""
387397
def __init__(self, canvas, num):
388398
if _debug: print('FigureManagerGTK3.%s' % fn_name())

lib/matplotlib/backends/backend_macosx.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,18 @@ class TimerMac(_macosx.Timer, TimerBase):
7171
Subclass of :class:`backend_bases.TimerBase` that uses CoreFoundation
7272
run loops for timer events.
7373
74-
Attributes:
75-
* interval: The time between timer events in milliseconds. Default
76-
is 1000 ms.
77-
* single_shot: Boolean flag indicating whether this timer should
78-
operate as single shot (run once and then stop). Defaults to False.
79-
* callbacks: Stores list of (func, args) tuples that will be called
80-
upon timer events. This list can be manipulated directly, or the
81-
functions add_callback and remove_callback can be used.
74+
Attributes
75+
----------
76+
interval: int
77+
The time between timer events in milliseconds. Default is 1000 ms.
78+
single_shot: bool
79+
Boolean flag indicating whether this timer should operate as single
80+
shot (run once and then stop). Defaults to False.
81+
callbacks: list
82+
Stores list of (func, args) tuples that will be called upon timer
83+
events. This list can be manipulated directly, or the functions
84+
`add_callback` and `remove_callback` can be used.
85+
< F438 /code>
8286
'''
8387
# completely implemented at the C-level (in _macosx.Timer)
8488

@@ -88,9 +92,11 @@ class FigureCanvasMac(_macosx.FigureCanvas, FigureCanvasAgg):
8892
The canvas the figure renders into. Calls the draw and print fig
8993
methods, creates the renderers, etc...
9094
91-
Public attribute
95+
Attributes
96+
----------
97+
figure
98+
A Figure instance
9299
93-
figure - A Figure instance
94100
95101
Events such as button presses, mouse movements, and key presses
96102
are handled in the C code and the base class methods
@@ -161,12 +167,12 @@ def new_timer(self, *args, **kwargs):
161167
This is useful for getting periodic events through the backend's native
162168
event loop. Implemented only for backends with GUIs.
163169
164-
optional arguments:
165-
166-
*interval*
170+
Keyword Arguments
171+
-----------------
172+
interval
167173
Timer interval in milliseconds
168-
*callbacks*
169-
Sequence of (func, args, kwargs) where func(*args, **kwargs) will
174+
callbacks
175+
Sequence of (func, args, kwargs) where func(\*args, \*\*kwargs) will
170176
be executed by the timer every *interval*.
171177
"""
172178
return TimerMac(*args, **kwargs)

lib/matplotlib/backends/backend_mixed.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,29 @@ def __init__(self, figure, width, height, dpi, vector_renderer,
2121
raster_renderer_class=None,
2222
bbox_inches_restore=None):
2323
"""
24-
figure: The figure instance.
24+
Parameters
25+
----------
26+
figure
27+
The figure instance.
2528
26-
width: The width of the canvas in logical units
29+
width
30+
The width of the canvas in logical units
2731
28-
height: The height of the canvas in logical units
32+
height
33+
The height of the canvas in logical units
2934
30-
dpi: The dpi of the canvas
35+
dpi
36+
The dpi of the canvas
3137
32-
vector_renderer: An instance of a subclass of RendererBase
33-
that will be used for the vector drawing.
38+
vector_renderer
39+
An instance of a subclass of RendererBase that will be used for the
40+
vector drawing.
41+
42+
raster_renderer_class
43+
The renderer class to use for the raster drawing. If not provided,
44+
this will use the Agg backend (which is currently the only viable
45+
option anyway.)
3446
35-
raster_renderer_class: The renderer class to use for the
36-
raster drawing. If not provided, this will use the Agg
37-
backend (which is currently the only viable option anyway.)
3847
"""
3948
if raster_renderer_class is None:
4049
raster_renderer_class = RendererAgg

lib/matplotlib/backends/backend_pdf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,9 +2502,11 @@ class FigureCanvasPdf(FigureCanvasBase):
25022502
The canvas the figure renders into. Calls the draw and print fig
25032503
methods, creates the renderers, etc...
25042504
2505-
Public attribute
2505+
Attributes
2506+
----------
2507+
figure
2508+
A Figure instance
25062509
2507-
figure - A Figure instance
25082510
"""
25092511

25102512
fixed_dpi = 72

lib/matplotlib/backends/backend_pgf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,13 @@ def __init__(self, figure, fh, dummy=False):
404404
Creates a new PGF renderer that translates any drawing instruction
405405
into text commands to be interpreted in a latex pgfpicture environment.
406406
407-
Attributes:
408-
* figure: Matplotlib figure to initialize height, width and dpi from.
409-
* fh: File handle for the output of the drawing commands.
407+
Attributes
408+
----------
409+
figure
410+
Matplotlib figure to initialize height, width and dpi from.
411+
fh
412+
File handle for the output of the drawing commands.
413+
410414
"""
411415
RendererBase.__init__(self)
412416
self.dpi = figure.dpi

lib/matplotlib/backends/backend_qt4agg.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ class FigureCanvasQTAgg(FigureCanvasQTAggBase,
6565
The canvas the figure renders into. Calls the draw and print fig
6666
methods, creates the renderers, etc...
6767
68-
Public attribute
68+
Attributes
69+
----------
70+
figure
71+
A Figure instance
6972
70-
figure - A Figure instance
71-
"""
73+
"""
7274

7375
def __init__(self, figure):
7476
if DEBUG:

0 commit comments

Comments
 (0)
0