|
1 | 1 | """
|
2 |
| -axis_artist.py module provides axis-related artists. They are |
| 2 | +The :mod:`.axis_artist` module implements custom artists to draw axis elements |
| 3 | +(axis lines and labels, tick lines and labels, grid lines). |
3 | 4 |
|
4 |
| -* axis line |
5 |
| -* tick lines |
6 |
| -* tick labels |
7 |
| -* axis label |
8 |
| -* grid lines |
| 5 | +Axis lines and labels and tick lines and labels are managed by the `AxisArtist` |
| 6 | +class; grid lines are managed by the `GridlinesCollection` class. |
9 | 7 |
|
10 |
| -The main artist classes are `AxisArtist` and `GridlinesCollection`. While |
11 |
| -`GridlinesCollection` is responsible for drawing grid lines, `AxisArtist` |
12 |
| -is responsible for all other artists. `AxisArtist` has attributes that are |
13 |
| -associated with each type of artists: |
| 8 | +There is one `AxisArtist` per Axis; it can be accessed through |
| 9 | +the ``axis`` dictionary of the parent Axes (which should be a |
| 10 | +`mpl_toolkits.axislines.Axes`), e.g. ``ax.axis["bottom"]``. |
14 | 11 |
|
15 |
| -* line: axis line |
16 |
| -* major_ticks: major tick lines |
17 |
| -* major_ticklabels: major tick labels |
18 |
| -* minor_ticks: minor tick lines |
19 |
| -* minor_ticklabels: minor tick labels |
20 |
| -* label: axis label |
| 12 | +Children of the AxisArtist are accessed as attributes: ``.line`` and ``.label`` |
| 13 | +for the axis line and label, ``.major_ticks``, ``.major_ticklabels``, |
| 14 | +``.minor_ticks``, ``.minor_ticklabels`` for the tick lines and labels (e.g. |
| 15 | +``ax.axis["bottom"].line``). |
21 | 16 |
|
22 |
| -Typically, the `AxisArtist` associated with an axes will be accessed with the |
23 |
| -*axis* dictionary of the axes, i.e., the `AxisArtist` for the bottom axis is :: |
| 17 | +Children properties (colors, fonts, line widths, etc.) can be set using |
| 18 | +setters, e.g. :: |
24 | 19 |
|
25 |
| - ax.axis["bottom"] |
26 |
| -
|
27 |
| -where *ax* is an instance of `mpl_toolkits.axislines.Axes`. Thus, |
28 |
| -``ax.axis["bottom"].line`` is an artist associated with the axis line, and |
29 |
| -``ax.axis["bottom"].major_ticks`` is an artist associated with the major tick |
30 |
| -lines. |
31 |
| -
|
32 |
| -You can change the colors, fonts, line widths, etc. of these artists |
33 |
| -by calling suitable set method. For example, to change the color of the major |
34 |
| -ticks of the bottom axis to red, use :: |
35 |
| -
|
36 |
| - ax.axis["bottom"].major_ticks.set_color("r") |
| 20 | + # Make the major ticks of the bottom axis red. |
| 21 | + ax.axis["bottom"].major_ticks.set_color("red") |
37 | 22 |
|
38 | 23 | However, things like the locations of ticks, and their ticklabels need to be
|
39 | 24 | changed from the side of the grid_helper.
|
|
0 commit comments