|
1 | 1 | r""" |
| 2 | +
|
| 3 | +.. redirect-from:: /tutorials/toolkits/axisartist |
| 4 | +
|
| 5 | +.. _axisartist: |
| 6 | +
|
2 | 7 | ====================== |
3 | 8 | The axisartist toolkit |
4 | 9 | ====================== |
|
15 | 20 | artist (AxisArtist) that can handle ticks, ticklines, etc. for |
16 | 21 | curved coordinate systems. |
17 | 22 |
|
18 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_floating_axis_001.png |
19 | | - :target: ../../gallery/axisartist/demo_floating_axis.html |
| 23 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_floating_axis_001.png |
| 24 | + :target: /gallery/axisartist/demo_floating_axis.html |
20 | 25 | :align: center |
21 | 26 |
|
22 | 27 | Since it uses special artists, some Matplotlib commands that work on |
|
60 | 65 | ax.axis["right"].set_visible(False) |
61 | 66 | ax.axis["top"].set_visible(False) |
62 | 67 |
|
63 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_simple_axisline3_001.png |
64 | | - :target: ../../gallery/axisartist/simple_axisline3.html |
| 68 | +.. figure:: /gallery/axisartist/images/sphx_glr_simple_axisline3_001.png |
| 69 | + :target: /gallery/axisartist/simple_axisline3.html |
65 | 70 | :align: center |
66 | 71 |
|
67 | 72 | It is also possible to add a horizontal axis. For example, you may have an |
68 | 73 | horizontal axis at y=0 (in data coordinate). :: |
69 | 74 |
|
70 | 75 | ax.axis["y=0"] = ax.new_floating_axis(nth_coord=0, value=0) |
71 | 76 |
|
72 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_simple_axisartist1_001.png |
73 | | - :target: ../../gallery/axisartist/simple_axisartist1.html |
| 77 | +.. figure:: /gallery/axisartist/images/sphx_glr_simple_axisartist1_001.png |
| 78 | + :target: /gallery/axisartist/simple_axisartist1.html |
74 | 79 | :align: center |
75 | 80 |
|
76 | 81 | Or a fixed axis with some offset :: |
|
92 | 97 |
|
93 | 98 | Here is an example that uses ParasiteAxes. |
94 | 99 |
|
95 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_parasite_axes2_001.png |
96 | | - :target: ../../gallery/axisartist/demo_parasite_axes2.html |
| 100 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_parasite_axes2_001.png |
| 101 | + :target: /gallery/axisartist/demo_parasite_axes2.html |
97 | 102 | :align: center |
98 | 103 |
|
99 | 104 | Curvilinear Grid |
|
102 | 107 | The motivation behind the AxisArtist module is to support a curvilinear grid |
103 | 108 | and ticks. |
104 | 109 |
|
105 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_curvelinear_grid_001.png |
106 | | - :target: ../../gallery/axisartist/demo_curvelinear_grid.html |
| 110 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_curvelinear_grid_001.png |
| 111 | + :target: /gallery/axisartist/demo_curvelinear_grid.html |
107 | 112 | :align: center |
108 | 113 |
|
109 | 114 | Floating Axes |
|
112 | 117 | AxisArtist also supports a Floating Axes whose outer axes are defined as |
113 | 118 | floating axis. |
114 | 119 |
|
115 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_floating_axes_001.png |
116 | | - :target: ../../gallery/axisartist/demo_floating_axes.html |
| 120 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_floating_axes_001.png |
| 121 | + :target: /gallery/axisartist/demo_floating_axes.html |
117 | 122 | :align: center |
118 | 123 |
|
119 | 124 | axisartist namespace |
|
144 | 149 | * a curvilinear grid. |
145 | 150 | * a floating axis |
146 | 151 |
|
147 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_floating_axis_001.png |
148 | | - :target: ../../gallery/axisartist/demo_floating_axis.html |
| 152 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_floating_axis_001.png |
| 153 | + :target: /gallery/axisartist/demo_floating_axis.html |
149 | 154 | :align: center |
150 | 155 |
|
151 | 156 | *mpl_toolkits.axisartist.Axes* class defines a *axis* attribute, which |
|
305 | 310 | ax1.axis["left"].major_ticklabels.set_axis_direction("top") |
306 | 311 | ax1.axis["right"].label.set_axis_direction("left") |
307 | 312 |
|
308 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_simple_axis_direction01_001.png |
309 | | - :target: ../../gallery/axisartist/simple_axis_direction01.html |
| 313 | +.. figure:: /gallery/axisartist/images/sphx_glr_simple_axis_direction01_001.png |
| 314 | + :target: /gallery/axisartist/simple_axis_direction01.html |
310 | 315 | :align: center |
311 | 316 |
|
312 | 317 | The parameter for set_axis_direction is one of ["left", "right", |
|
330 | 335 | to the *ticklabel_direction* or *label_direction*, |
331 | 336 | respectively. The rotation of ticklabels and label is anchored. |
332 | 337 |
|
333 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_axis_direction_001.png |
334 | | - :target: ../../gallery/axisartist/axis_direction.html |
| 338 | +.. figure:: /gallery/axisartist/images/sphx_glr_axis_direction_001.png |
| 339 | + :target: /gallery/axisartist/axis_direction.html |
335 | 340 | :align: center |
336 | 341 |
|
337 | 342 | On the other hand, there is a concept of "axis_direction". This is a |
|
355 | 360 | etc, for settings suitable for "top" axis. The concept of axis |
356 | 361 | direction can be more clear with curved axis. |
357 | 362 |
|
358 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_axis_direction_001.png |
359 | | - :target: ../../gallery/axisartist/demo_axis_direction.html |
| 363 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_axis_direction_001.png |
| 364 | + :target: /gallery/axisartist/demo_axis_direction.html |
360 | 365 | :align: center |
361 | 366 |
|
362 | 367 | The axis_direction can be adjusted in the AxisArtist level, or in the |
|
386 | 391 |
|
387 | 392 | ax.axis[:].major_ticks.set_tick_out(True) |
388 | 393 |
|
389 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_simple_axis_direction03_001.png |
390 | | - :target: ../../gallery/axisartist/simple_axis_direction03.html |
| 394 | +.. figure:: /gallery/axisartist/images/sphx_glr_simple_axis_direction03_001.png |
| 395 | + :target: /gallery/axisartist/simple_axis_direction03.html |
391 | 396 | :align: center |
392 | 397 |
|
393 | 398 | So, in summary, |
|
421 | 426 |
|
422 | 427 | Alignment of TickLabels are treated specially. See below |
423 | 428 |
|
424 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_ticklabel_alignment_001.png |
425 | | - :target: ../../gallery/axisartist/demo_ticklabel_alignment.html |
| 429 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_ticklabel_alignment_001.png |
| 430 | + :target: /gallery/axisartist/demo_ticklabel_alignment.html |
426 | 431 | :align: center |
427 | 432 |
|
428 | 433 | Adjusting pad |
|
436 | 441 |
|
437 | 442 | ax.axis["left"].label.set_pad(10) |
438 | 443 |
|
439 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_simple_axis_pad_001.png |
440 | | - :target: ../../gallery/axisartist/simple_axis_pad.html |
| 444 | +.. figure:: /gallery/axisartist/images/sphx_glr_simple_axis_pad_001.png |
| 445 | + :target: /gallery/axisartist/simple_axis_pad.html |
441 | 446 | :align: center |
442 | 447 |
|
443 | 448 | GridHelper |
@@ -521,8 +526,8 @@ def inv_tr(x, y): |
521 | 526 | # note that ax2.transData == tr + ax1.transData |
522 | 527 | # Anything you draw in ax2 will match the ticks and grids of ax1. |
523 | 528 |
|
524 | | -.. figure:: ../../gallery/axisartist/images/sphx_glr_demo_curvelinear_grid_001.png |
525 | | - :target: ../../gallery/axisartist/demo_curvelinear_grid.html |
| 529 | +.. figure:: /gallery/axisartist/images/sphx_glr_demo_curvelinear_grid_001.png |
| 530 | + :target: /gallery/axisartist/demo_curvelinear_grid.html |
526 | 531 | :align: center |
527 | 532 |
|
528 | 533 | FloatingAxis |
|
0 commit comments