|
40 | 40 | # It is often desirable to use different `property cycles |
41 | 41 | # <https://matplotlib.org/tutorials/intermediate/color_cycle.html#sphx-glr-tutorials-intermediate-color-cycle-py>`__ |
42 | 42 | # for different axes or different plot elements. To enable this, the |
43 | | -# `~proplot.wrappers.cycle_changer` adds the `cycle` and `cycle_kw` to the 1D |
| 43 | +# `~proplot.axes.cycle_changer` adds the `cycle` and `cycle_kw` to the 1D |
44 | 44 | # plotting methods. These arguments are passed to the |
45 | 45 | # `~proplot.constructor.Cycle` constructor function, and the resulting property |
46 | 46 | # cycle is used to style the input data. ProPlot iterates through property |
|
76 | 76 | # Standardized arguments |
77 | 77 | # ---------------------- |
78 | 78 | # |
79 | | -# The `~proplot.wrappers.standardize_1d` wrapper is used to standardize |
| 79 | +# The `~proplot.axes.standardize_1d` wrapper is used to standardize |
80 | 80 | # positional arguments across all 1D plotting methods. |
81 | | -# `~proplot.wrappers.standardize_1d` allows you to optionally omit *x* |
| 81 | +# `~proplot.axes.standardize_1d` allows you to optionally omit *x* |
82 | 82 | # coordinates, in which case they are inferred from the data. It also permits |
83 | 83 | # passing 2D *y* coordinate arrays to any plotting method, in which case the |
84 | 84 | # plotting method is called for each column of the array. |
|
100 | 100 | # Plot by passing both x and y coordinates |
101 | 101 | ax = axs[0] |
102 | 102 | ax.area(x, -1 * y / N, stacked=True) |
103 | | - ax.bar(x, y, linewidth=0, alpha=1, width=0.8 * (x[1] - x[0])) |
| 103 | + ax.bar(x, y, linewidth=0, alpha=1, width=0.8) |
104 | 104 | ax.plot(x, y + 1, linewidth=2) |
105 | 105 | ax.scatter(x, y + 2, marker='s', markersize=5**2) |
106 | 106 | ax.format(title='Manual x coordinates') |
|
122 | 122 | # Pandas and xarray integration |
123 | 123 | # ----------------------------- |
124 | 124 | # |
125 | | -# The `~proplot.wrappers.standardize_1d` wrapper integrates 1D plotting |
| 125 | +# The `~proplot.axes.standardize_1d` wrapper integrates 1D plotting |
126 | 126 | # methods with pandas `~pandas.DataFrame`\ s and xarray `~xarray.DataArray`\ s. |
127 | 127 | # When you pass a DataFrame or DataArray to any plotting command, the x-axis |
128 | 128 | # label, y-axis label, legend label, colorbar label, and/or title are |
|
185 | 185 | # Adding error bars |
186 | 186 | # ----------------- |
187 | 187 | # |
188 | | -# The `~proplot.wrappers.add_errorbars` wrapper lets you draw error bars |
| 188 | +# The `~proplot.axes.add_errorbars` wrapper lets you draw error bars |
189 | 189 | # on-the-fly by passing certain keyword arguments to |
190 | 190 | # `~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`, |
191 | 191 | # `~matplotlib.axes.Axes.bar`, or `~matplotlib.axes.Axes.barh`. |
192 | 192 | # |
193 | 193 | # If you pass 2D arrays to these methods with ``means=True`` or |
194 | 194 | # ``medians=True``, the means or medians of each column are drawn as points, |
195 | 195 | # lines, or bars, and error bars are drawn to represent the spread in each |
196 | | -# column. `~proplot.wrappers.add_errorbars` lets you draw both thin error |
| 196 | +# column. `~proplot.axes.add_errorbars` lets you draw both thin error |
197 | 197 | # "bars" with optional whiskers, and thick error "boxes" overlayed on top of |
198 | 198 | # these bars (this can be used to represent different percentil ranges). |
199 | 199 | # Instead of using 2D arrays, you can also pass error bar coordinates |
200 | 200 | # *manually* with the `bardata` and `boxdata` keyword arguments. See |
201 | | -# `~proplot.wrappers.add_errorbars` for details. |
| 201 | +# `~proplot.axes.add_errorbars` for details. |
202 | 202 |
|
203 | 203 | # %% |
204 | 204 | import proplot as plot |
|
254 | 254 | # ------------------------ |
255 | 255 | # |
256 | 256 | # The `~matplotlib.axes.Axes.bar` and `~matplotlib.axes.Axes.barh` methods |
257 | | -# are wrapped by `~proplot.wrappers.bar_wrapper`, |
258 | | -# `~proplot.wrappers.cycle_changer`, and `~proplot.wrappers.standardize_1d`. |
| 257 | +# are wrapped by `~proplot.axes.bar_wrapper`, |
| 258 | +# `~proplot.axes.cycle_changer`, and `~proplot.axes.standardize_1d`. |
259 | 259 | # You can now *group* or *stack* columns of data by passing 2D arrays to |
260 | 260 | # `~matplotlib.axes.Axes.bar` or `~matplotlib.axes.Axes.barh`, just like in |
261 | 261 | # `pandas`. Also, `~matplotlib.axes.Axes.bar` and `~matplotlib.axes.Axes.barh` |
|
266 | 266 | # `~proplot.axes.Axes.areax` methods. These are alises for |
267 | 267 | # `~matplotlib.axes.Axes.fill_between` and |
268 | 268 | # `~matplotlib.axes.Axes.fill_betweenx`, which are now wrapped by |
269 | | -# `~proplot.wrappers.fill_between_wrapper` and |
270 | | -# `~proplot.wrappers.fill_betweenx_wrapper`. You can now *stack* or *overlay* |
| 269 | +# `~proplot.axes.fill_between_wrapper` and |
| 270 | +# `~proplot.axes.fill_betweenx_wrapper`. You can now *stack* or *overlay* |
271 | 271 | # columns of data by passing 2D arrays to `~proplot.axes.Axes.area` and |
272 | 272 | # `~proplot.axes.Axes.areax`, just like in `pandas`. You can also now draw |
273 | 273 | # area plots that *change color* when the fill boundaries cross each other by |
|
350 | 350 | # -------------------------- |
351 | 351 | # |
352 | 352 | # The `~matplotlib.axes.Axes.boxplot` and `~matplotlib.axes.Axes.violinplot` |
353 | | -# methods are now wrapped with `~proplot.wrappers.boxplot_wrapper`, |
354 | | -# `~proplot.wrappers.violinplot_wrapper`, `~proplot.wrappers.cycle_changer`, |
355 | | -# and `~proplot.wrappers.standardize_1d`. These wrappers add some useful |
| 353 | +# methods are now wrapped with `~proplot.axes.boxplot_wrapper`, |
| 354 | +# `~proplot.axes.violinplot_wrapper`, `~proplot.axes.cycle_changer`, |
| 355 | +# and `~proplot.axes.standardize_1d`. These wrappers add some useful |
356 | 356 | # options and apply aesthetically pleasing default settings. They also |
357 | 357 | # automatically apply axis labels based on the `~pandas.DataFrame` column |
358 | 358 | # labels or the input *x* coordinate labels. |
|
446 | 446 | xlim=(-1, 1), ylim=(-1, 1), title='Step gradations', |
447 | 447 | xlabel='cosine angle', ylabel='sine angle' |
448 | 448 | ) |
449 | | -ax.colorbar(m, loc='b', maxn=10, label=f'parametric coordinate') |
| 449 | +ax.colorbar(m, loc='b', maxn=10, label='parametric coordinate') |
450 | 450 |
|
451 | 451 |
|
452 | 452 | # %% [raw] raw_mimetype="text/restructuredtext" |
|
456 | 456 | # ------------- |
457 | 457 | # |
458 | 458 | # The `~matplotlib.axes.Axes.scatter` method is now wrapped by |
459 | | -# `~proplot.wrappers.scatter_wrapper`, `~proplot.wrappers.cycle_changer`, and |
460 | | -# `~proplot.wrappers.standardize_1d`. This means that |
| 459 | +# `~proplot.axes.scatter_wrapper`, `~proplot.axes.cycle_changer`, and |
| 460 | +# `~proplot.axes.standardize_1d`. This means that |
461 | 461 | # `~matplotlib.axes.Axes.scatter` now accepts 2D arrays, just like |
462 | 462 | # `~matplotlib.axes.Axes.plot`. Also, successive calls to |
463 | 463 | # `~matplotlib.axes.Axes.scatter` now use the property cycler properties |
|
0 commit comments