@@ -66,25 +66,15 @@ many additional methods to interact with the plots.
66
66
Keyword parameters in ``**kws `` other than those listed above are sent to the wx.Panel.
67
67
68
68
69
- :class: `PlotPanel ` methods
70
- =============================================
71
-
72
-
73
- .. method :: plot(x, y, **kws)
74
-
75
- Draw a plot of the numpy arrays *x * and *y *, erasing any existing plot. The
76
- displayed curve for these data is called a *trace *. The :meth: `plot ` method
77
- has many optional parameters, all using keyword/value argument. Since most
78
- of these are shared with the :meth: `oplot ` method, the full set of parameters
79
- is given in :ref: `Table of Plot Arguments <plotopt_table >`
80
-
81
- .. method :: oplot(x, y, **kws)
69
+ :class: `PlotPanel ` conventions and common arguments
70
+ ============================================================
82
71
83
- Draw a plot of the numpy arrays *x * and *y *, overplotting any existing
84
- plot, so that both traces are visible.
72
+ The :class: `PlotPanel ` methods below share many conventions and use
73
+ common arguments where possible. A list of common function argumets
74
+ for :meth: `plot `, :meth: `oplot `, and :meth: `scatterplot is given in
75
+ :ref:`Table of Plot Arguments <plotopt_table> `. Many of these
76
+ arguments and terms are alsoe used in the other function methods.
85
77
86
- The :meth: `oplot ` method has many optional parameters, as listed in
87
- :ref: `Table of Plot Arguments <plotopt_table >`
88
78
89
79
.. _plotopt_table :
90
80
@@ -127,9 +117,9 @@ same meaning, as indicated by the right-most column.
127
117
+------------------+------------+---------+------------------------------------------------+-----+--------------+
128
118
| drawstyle | string | line | style connecting points of trace | 8 | no |
129
119
+------------------+------------+---------+------------------------------------------------+-----+--------------+
130
- | side | string | left | location (side) for y-axis and label | 9 | no |
120
+ | side | string | None | location (side) for y-axes and label | 9 | no |
131
121
+------------------+------------+---------+------------------------------------------------+-----+--------------+
132
- | yaxes | 1,2,3,4 | 1 | location (side) for y-axis and label | 9 | no |
122
+ | yaxes | 1,2,3,4 | 1 | location (side) for y-axes and label | 9 | no |
133
123
+------------------+------------+---------+------------------------------------------------+-----+--------------+
134
124
| yaxes_tracecolor | bool | False | use trace color for multiple y-axes | 9 | no |
135
125
+------------------+------------+---------+------------------------------------------------+-----+--------------+
@@ -189,16 +179,16 @@ same meaning, as indicated by the right-most column.
189
179
+------------------+------------+---------+------------------------------------------------+-----+--------------+
190
180
191
181
192
- As a general note, the configuration for the plot (title, labels, grid
193
- displays) and for each trace (color, linewidth, ...) are preserved for a
194
- :class: ` PlotPanel `. A few specific notes:
182
+ As a general note, the configuration for the plot (title, labels, grid displays) and
183
+ for each trace (color, linewidth, ...) are preserved for a :class: ` PlotPanel `. A few
184
+ specific notes:
195
185
196
186
1. The title, label, and grid arguments to :meth: `plot ` default to ``None ``, which
197
187
means to use the previously used value.
198
188
199
- 2. The *theme * will set the color palette and make stylistic choices. Choices
200
- include 'light' (the default), 'white-background', 'dark', 'matplotlib',
201
- 'seaborn', ' ggplot', 'bmh', 'fivethirtyeight', 'grayscale', 'dark_background',
189
+ 2. The *theme * will set the color palette and make stylistic choices. Choices include
190
+ 'light' (the default), 'white-background', 'dark', 'matplotlib', 'seaborn ',
191
+ 'ggplot', 'bmh', 'fivethirtyeight', 'grayscale', 'dark_background',
202
192
'tableau-colorblind10', 'seaborn-bright', 'seaborn-colorblind', 'seaborn-dark',
203
193
'seaborn-darkgrid', 'seaborn-dark-palette', 'seaborn-deep', 'seaborn-notebook',
204
194
'seaborn-muted', 'seaborn-pastel', 'seaborn-paper', 'seaborn-poster',
@@ -232,10 +222,10 @@ same meaning, as indicated by the right-most column.
232
222
discrete values as a function of time, left-to-right, and want to show a
233
223
transition to a new value as a sudden step, you want 'steps-post'.
234
224
235
- 9. *side * can by one of ('left', 'right', 'right2', 'right3') or * yaxes * can
236
- be one on (1, 2, 3, 4). These are exactly equivalent ways to spectify
237
- which Y axes to use. Setting * yaxes_tracecolor * will make the
238
- Y axes use the same color as the trace using that Y axes .
225
+ 9. *side * can by one of (`` None ``, 'left', 'right', 'right2', 'right3') (default=``None``)
226
+ or * yaxes * can be one on (1, 2, 3, 4) (default=1, for left-hand axes). Setting
227
+ * yaxes_tracecolor * will make the Y axes use the same color as the trace using that
228
+ Y axes. See :ref: ` sect_yaxes_side ` for details .
239
229
240
230
10. *marker * is one of ('+', 'o', 'x', '^', 'v', '>', '<', '|', '_', 'square',
241
231
'diamond', 'thin diamond', 'hexagon', 'pentagon', 'tripod 1', or 'tripod 2').
@@ -266,14 +256,92 @@ same meaning, as indicated by the right-most column.
266
256
All of these values, and a few more settings controlling whether and how to display a plot legend can be
267
257
configured interactively (see Plot Configuration).
268
258
269
- .. method :: update_line(trace, x, y, side='left', update_limits=True, draw=False)
259
+
260
+ .. _sect_yaxes_side :
261
+
262
+ Selecting Y-axes (left- or right-hand side)
263
+ =======================================================
264
+
265
+ While a basic use of :class: `PlotPanel ` will have a single Y-axes, it
266
+ is sometimes useful to plot multiple traces together that have
267
+ different ranges of Y values. Using 2 Y-axes -- the left- and
268
+ right-hand sides of the plot is a very common need. Sometimes 3 or
269
+ even 4 Y axes sharing an X axes can be helpful, and :class: `PlotPanel `
270
+ supports plots with up to 4 of these.
271
+
272
+ To specify which Y axes to use, we recommeded using the argument
273
+ `yaxes ` which can be an integer 1, 2, 3, or 4, where 1 (the default)
274
+ means the left-hand side of the plot, 2 the right-hand side, and 3 and
275
+ 4 additional axes displaced from the right-hand side. (see
276
+ :ref: `example_leftright ` and :ref: `example_multiple_yaxes `). For backward
277
+ compatibility (and with no intention to deprecate this), this can also
278
+ be set with the argument `side `, which can be ``None `` (meaning "use
279
+ the value of `yaxes `") or one of ('left', 'right', 'right2',
280
+ 'right3'), m (default=``None``).
281
+
282
+ Setting `yaxes_tracecolor ` to ``True `` will make each of the Y axes
283
+ use the same color as the trace using that Y axes.
284
+
285
+
286
+ .. _sect_datetime :
287
+
288
+ Using date-time data with :func: `plot `
289
+ ===========================================
290
+
291
+ If the `x ` values to be plotted holds date or time data, these can be handled in
292
+ a few different formats. In order for the X-axis labels to be properly
293
+ displayed as a string showing the date, the values must be eventually converted
294
+ to a `matplotlib.dates ` object, which uses a floating point number to represent
295
+ the number of days since year 0, BCE. The `wxmplot ` user is not expected to do
296
+ this conversion.
297
+
298
+ The best way to specify datetime information is to use `datetime ` objects
299
+ from the `datetime ` library. These will be automatically recognized and
300
+ properly converted.
301
+
302
+ If the `x ` data is a list or array of integers or floats and `use_dates=True ` is
303
+ used, the values will be interpreted as Unix timestamps (seconds since 1970),
304
+ unless `dates_styles='dates' `, in which case they will be interpreted as
305
+ `matplotlib.dates `.
306
+
307
+ Finally, it is possible to pass in a list or array of strings as `x `, and set
308
+ `use_dates=True `. In this case, the `matplotlib.dates.datestr2num ` function
309
+ will be used convert the string. Of course, whether this actually works well
310
+ will depend on the ability of this function to parse and interpret the date
311
+ strings used.
312
+
313
+
314
+
315
+
316
+ :class: `PlotPanel ` methods
317
+ =============================================
318
+
319
+
320
+ .. method :: plot(x, y, **kws)
321
+
322
+ Draw a plot of the numpy arrays *x * and *y *, erasing any existing plot. The
323
+ displayed curve for these data is called a *trace *. The :meth: `plot ` method
324
+ has many optional parameters, all using keyword/value argument. Since most
325
+ of these are shared with the :meth: `oplot ` method, the full set of parameters
326
+ is given in :ref: `Table of Plot Arguments <plotopt_table >`
327
+
328
+ .. method :: oplot(x, y, **kws)
329
+
330
+ Draw a plot of the numpy arrays *x * and *y *, overplotting any existing
331
+ plot, so that both traces are visible.
332
+
333
+ The :meth: `oplot ` method has many optional parameters, as listed in
334
+ :ref: `Table of Plot Arguments <plotopt_table >`
335
+
336
+ .. method :: update_line(trace, x, y, yaxes=1, side=None, update_limits=True, draw=False)
270
337
271
338
update an existing trace.
272
339
273
340
:param trace: integer index for the trace (0 is the first trace)
274
341
:param x: array of x values
275
342
:param y: array of y values
276
- :param side: which y axis to use ('left', 'right', 'right2', or 'right3').
343
+ :param side: which y axis to use. See :ref: `sect_yaxes_side `.
344
+ :param yaxes: which y axis to use.
277
345
:param update_limits: whether to force an update of the limits.
278
346
:param draw: whether to force a redrawing of the canvas.
279
347
@@ -306,20 +374,21 @@ same meaning, as indicated by the right-most column.
306
374
307
375
Clear the plot.
308
376
309
- .. method :: add_text(text, x, y, side='left' , rotation=None, ha='left', va='center', family=None, **kws)
377
+ .. method :: add_text(text, x, y, yaxes=1, side=None , rotation=None, ha='left', va='center', family=None, **kws)
310
378
311
379
add text to the plot.
312
380
313
381
:param text: text to write
314
382
:param x: x coordinate for text
315
383
:param y: y coordinate for text
316
- :param side: which axis to use ('left' or 'right') for coordinates.
384
+ :param side: which y-axes to use for coordinates. See :ref: `sect_yaxes_side `.
385
+ :param yaxes: which y-axes to use for coordinates.
317
386
:param rotation: text rotation: angle in degrees or 'vertical' or 'horizontal'
318
387
:param ha: horizontal alignment ('left', 'center', 'right')
319
388
:param va: vertical alignment ('top', 'center', 'bottom', 'baseline')
320
389
:param family: name of font family ('serif', 'sans-serif', etc)
321
390
322
- .. method :: add_arrow(x1, y1, x2, y2, side='left' , shape='full', color='black', wdith=0.01, head_width=0.03, overhang=0)
391
+ .. method :: add_arrow(x1, y1, x2, y2, yaxes=1, side=None , shape='full', color='black', wdith=0.01, head_width=0.03, overhang=0)
323
392
324
393
325
394
draw arrow from (x1, y1) to (x2, y2).
@@ -328,22 +397,24 @@ same meaning, as indicated by the right-most column.
328
397
:param y1: starting y coordinate
329
398
:param x2: endnig x coordinate
330
399
:param y2: ending y coordinate
331
- :param side: which axis to use ('left' or 'right') for coordinates.
400
+ :param side: which y-axes to use for coordinates. See :ref: `sect_yaxes_side `.
401
+ :param yaxes: which y-axes to use for coordinates.
332
402
:param shape: arrow head shape ('full', 'left', 'right')
333
403
:param color: arrow fill color ('black')
334
404
:param width: width of arrow line (in points. default=0.01)
335
405
:param head_width: width of arrow head (in points. default=0.1)
336
406
:param overhang: amount the arrow is swept back (in points. default=0)
337
407
338
408
339
- .. method :: set_xylims(limits[, axes=None[, side=None]])
409
+ .. method :: set_xylims(limits[, axes=None[, side=None, yaxes=1 ]])
340
410
341
411
Set the x and y limits for a plot based on a 2x2 list.
342
412
343
413
:param limits: x and y limits
344
414
:type limits: a 4-element list: [xmin, xmax, ymin, ymax]
345
415
:param axes: instance of matplotlib axes to use (i.e, for right or left side y axes)
346
- :param side: set to 'right' to get right-hand axes.
416
+ :param side: which y-axes to use. See :ref: `sect_yaxes_side `.
417
+ :param yaxes: which y-axis to use.
347
418
348
419
.. method :: get_xylims()
349
420
@@ -395,33 +466,6 @@ same meaning, as indicated by the right-most column.
395
466
reset the configuration to default settings.
396
467
397
468
398
- .. _sect_datetime :
399
-
400
- Using date-time data with :func: `plot `
401
- ===========================================
402
-
403
- If the `x ` values to be plotted holds date or time data, these can be handled in
404
- a few different formats. In order for the X-axis labels to be properly
405
- displayed as a string showing the date, the values must be eventually converted
406
- to a `matplotlib.dates ` object, which uses a floating point number to represent
407
- the number of days since year 0, BCE. The `wxmplot ` user is not expected to do
408
- this conversion.
409
-
410
- The best way to specify datetime information is to use `datetime ` objects
411
- from the `datetime ` library. These will be automatically recognized and
412
- properly converted.
413
-
414
- If the `x ` data is a list or array of integers or floats and `use_dates=True ` is
415
- used, the values will be interpreted as Unix timestamps (seconds since 1970),
416
- unless `dates_styles='dates' `, in which case they will be interpreted as
417
- `matplotlib.dates `.
418
-
419
- Finally, it is possible to pass in a list or array of strings as `x `, and set
420
- `use_dates=True `. In this case, the `matplotlib.dates.datestr2num ` function
421
- will be used convert the string. Of course, whether this actually works well
422
- will depend on the ability of this function to parse and interpret the date
423
- strings used.
424
-
425
469
426
470
427
471
:class: `PlotFrame `: a wx.Frame showing a :class: `PlotPanel `
0 commit comments