@@ -135,26 +135,24 @@ def points_to_pixels(self, points):
135
135
136
136
class GraphicsContextTemplate (GraphicsContextBase ):
137
137
"""
138
- The graphics context provides the color, line styles, etc... See the gtk
138
+ The graphics context provides the color, line styles, etc... See the cairo
139
139
and postscript backends for examples of mapping the graphics context
140
140
attributes (cap styles, join styles, line widths, colors) to a particular
141
- backend. In GTK this is done by wrapping a gtk.gdk.GC object and
141
+ backend. In cairo this is done by wrapping a cairo.Context object and
142
142
forwarding the appropriate calls to it using a dictionary mapping styles
143
143
to gdk constants. In Postscript, all the work is done by the renderer,
144
144
mapping line styles to postscript calls.
145
145
146
146
If it's more appropriate to do the mapping at the renderer level (as in
147
147
the postscript backend), you don't need to override any of the GC methods.
148
- If it's more appropriate to wrap an instance (as in the GTK backend) and
148
+ If it's more appropriate to wrap an instance (as in the cairo backend) and
149
149
do the mapping here, you'll need to override several of the setter
150
150
methods.
151
151
152
152
The base GraphicsContext stores colors as a RGB tuple on the unit
153
153
interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors
154
154
appropriate for your backend.
155
155
"""
156
- pass
157
-
158
156
159
157
160
158
########################################################################
@@ -166,19 +164,18 @@ class GraphicsContextTemplate(GraphicsContextBase):
166
164
167
165
def draw_if_interactive ():
168
166
"""
169
- For image backends - is not required
167
+ For image backends - is not required.
170
168
For GUI backends - this should be overridden if drawing should be done in
171
- interactive python mode
169
+ interactive python mode.
172
170
"""
173
171
174
172
175
173
def show (block = None ):
176
174
"""
177
- For image backends - is not required
175
+ For image backends - is not required.
178
176
For GUI backends - show() is usually the last line of a pyplot script and
179
- tells the backend that it is time to draw. In interactive mode, this may
180
- be a do nothing func. See the GTK backend for an example of how to handle
181
- interactive versus batch mode
177
+ tells the backend that it is time to draw. In interactive mode, this
178
+ should do nothing.
182
179
"""
183
180
for manager in Gcf .get_all_fig_managers ():
184
181
# do something to display the GUI
@@ -189,12 +186,11 @@ def new_figure_manager(num, *args, FigureClass=Figure, **kwargs):
189
186
"""
190
187
Create a new figure manager instance
191
188
"""
192
- # May be implemented via the `_new_figure_manager_template` helper.
193
189
# If a main-level app must be created, this (and
194
190
# new_figure_manager_given_figure) is the usual place to do it -- see
195
191
# backend_wx, backend_wxagg and backend_tkagg for examples. Not all GUIs
196
- # require explicit instantiation of a main-level app (egg backend_gtk,
197
- # backend_gtkagg) for pylab.
192
+ # require explicit instantiation of a main-level app (e.g., backend_gtk3)
193
+ # for pylab.
198
194
thisFig = FigureClass (* args , ** kwargs )
199
195
return new_figure_manager_given_figure (num , thisFig )
200
196
@@ -203,7 +199,6 @@ def new_figure_manager_given_figure(num, figure):
203
199
"""
204
200
Create a new figure manager instance for the given figure.
205
201
"""
206
- # May be implemented via the `_new_figure_manager_template` helper.
207
202
canvas = FigureCanvasTemplate (figure )
208
203
manager = FigureManagerTemplate (canvas , num )
209
204
return manager
@@ -212,19 +207,18 @@ def new_figure_manager_given_figure(num, figure):
212
207
class FigureCanvasTemplate (FigureCanvasBase ):
213
208
"""
214
209
The canvas the figure renders into. Calls the draw and print fig
215
- methods, creates the renderers, etc...
210
+ methods, creates the renderers, etc.
216
211
217
- Note GUI templates will want to connect events for button presses,
212
+ Note: GUI templates will want to connect events for button presses,
218
213
mouse movements and key presses to functions that call the base
219
214
class methods button_press_event, button_release_event,
220
- motion_notify_event, key_press_event, and key_release_event. See,
221
- e.g., backend_gtk.py, backend_wx.py and backend_tkagg.py
215
+ motion_notify_event, key_press_event, and key_release_event. See the
216
+ implementations of the interactive backends for examples.
222
217
223
218
Attributes
224
219
----------
225
220
figure : `matplotlib.figure.Figure`
226
221
A high-level Figure instance
227
-
228
222
"""
229
223
230
224
def draw (self ):
0 commit comments