Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 654858a

Browse filesBrowse files
committed
Merge all axisartist axis_direction demos together.
There's still no text, which I'm not volunteering to do here :-) but at least putting them all next to one another should make the API possibilities a bit clearer.
1 parent 5c486d7 commit 654858a
Copy full SHA for 654858a

File tree

Expand file treeCollapse file tree

6 files changed

+82
-222
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+82
-222
lines changed

‎examples/axisartist/axis_direction.py

Copy file name to clipboard
+67Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""
2+
==============
3+
Axis Direction
4+
==============
5+
"""
6+
7+
import matplotlib.pyplot as plt
8+
import mpl_toolkits.axisartist as axisartist
9+
10+
11+
def setup_axes(fig, rect):
12+
ax = fig.add_axes(axisartist.Subplot(fig, rect))
13+
14+
ax.set_ylim(-0.1, 1.5)
15+
ax.set_yticks([0, 1])
16+
17+
ax.axis[:].set_visible(False)
18+
19+
ax.axis["x"] = ax.new_floating_axis(1, 0.5)
20+
ax.axis["x"].set_axisline_style("->", size=1.5)
21+
22+
return ax
23+
24+
25+
plt.rcParams.update({
26+
"axes.titlesize": "medium",
27+
"axes.titley": 1.1,
28+
})
29+
30+
fig = plt.figure(figsize=(10, 4))
31+
fig.subplots_adjust(bottom=0.1, top=0.9, left=0.05, right=0.95)
32+
33+
ax1 = setup_axes(fig, 251)
34+
ax1.axis["x"].set_axis_direction("left")
35+
36+
ax2 = setup_axes(fig, 252)
37+
ax2.axis["x"].label.set_text("Label")
38+
ax2.axis["x"].toggle(ticklabels=False)
39+
ax2.axis["x"].set_axislabel_direction("+")
40+
ax2.set_title("label direction=$+$")
41+
42+
ax3 = setup_axes(fig, 253)
43+
ax3.axis["x"].label.set_text("Label")
44+
ax3.axis["x"].toggle(ticklabels=False)
45+
ax3.axis["x"].set_axislabel_direction("-")
46+
ax3.set_title("label direction=$-$")
47+
48+
ax4 = setup_axes(fig, 254)
49+
ax4.axis["x"].set_ticklabel_direction("+")
50+
ax4.set_title("ticklabel direction=$+$")
51+
52+
ax5 = setup_axes(fig, 255)
53+
ax5.axis["x"].set_ticklabel_direction("-")
54+
ax5.set_title("ticklabel direction=$-$")
55+
56+
ax7 = setup_axes(fig, 257)
57+
ax7.axis["x"].label.set_text("rotation=10")
58+
ax7.axis["x"].label.set_rotation(10)
59+
ax7.axis["x"].toggle(ticklabels=False)
60+
61+
ax8 = setup_axes(fig, 258)
62+
ax8.axis["x"].set_axislabel_direction("-")
63+
ax8.axis["x"].label.set_text("rotation=10")
64+
ax8.axis["x"].label.set_rotation(10)
65+
ax8.axis["x"].toggle(ticklabels=False)
66+
67+
plt.show()

‎examples/axisartist/axis_direction_demo_step01.py

Copy file name to clipboardExpand all lines: examples/axisartist/axis_direction_demo_step01.py
-32Lines changed: 0 additions & 32 deletions
This file was deleted.

‎examples/axisartist/axis_direction_demo_step02.py

Copy file name to clipboardExpand all lines: examples/axisartist/axis_direction_demo_step02.py
-43Lines changed: 0 additions & 43 deletions
This file was deleted.

‎examples/axisartist/axis_direction_demo_step03.py

Copy file name to clipboardExpand all lines: examples/axisartist/axis_direction_demo_step03.py
-47Lines changed: 0 additions & 47 deletions
This file was deleted.

‎examples/axisartist/axis_direction_demo_step04.py

Copy file name to clipboardExpand all lines: examples/axisartist/axis_direction_demo_step04.py
-60Lines changed: 0 additions & 60 deletions
This file was deleted.

‎tutorials/toolkits/axisartist.py

Copy file name to clipboardExpand all lines: tutorials/toolkits/axisartist.py
+15-40Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -340,51 +340,26 @@
340340
341341
You must understand some underlying concept of directions.
342342
343-
1. There is a reference direction which is defined as the direction
344-
of the axis line with increasing coordinate. For example, the
345-
reference direction of the left x-axis is from bottom to top.
343+
- There is a reference direction which is defined as the direction
344+
of the axis line with increasing coordinate. For example, the
345+
reference direction of the left x-axis is from bottom to top.
346346
347-
.. figure:: ../../gallery/axisartist/images/sphx_glr_axis_direction_demo_step01_001.png
348-
:target: ../../gallery/axisartist/axis_direction_demo_step01.html
349-
:align: center
350-
:scale: 50
347+
The direction, text angle, and alignments of the ticks, ticklabels and
348+
axis-label is determined with respect to the reference direction
351349
352-
Axis Direction Demo - Step 01
350+
- *label_direction* and *ticklabel_direction* are either the right-hand side
351+
(+) of the reference direction or the left-hand side (-).
353352
354-
The direction, text angle, and alignments of the ticks, ticklabels and
355-
axis-label is determined with respect to the reference direction
353+
- ticks are by default drawn toward the opposite direction of the ticklabels.
356354
357-
2. *ticklabel_direction* is either the right-hand side (+) of the
358-
reference direction or the left-hand side (-).
355+
- text rotation of ticklabels and label is determined in reference
356+
to the *ticklabel_direction* or *label_direction*,
357+
respectively. The rotation of ticklabels and label is anchored.
359358
360-
.. figure:: ../../gallery/axisartist/images/sphx_glr_axis_direction_demo_step02_001.png
361-
:target: ../../gallery/axisartist/axis_direction_demo_step02.html
362-
:align: center
363-
:scale: 50
364-
365-
Axis Direction Demo - Step 02
366-
367-
3. same for the *label_direction*
368-
369-
.. figure:: ../../gallery/axisartist/images/sphx_glr_axis_direction_demo_step03_001.png
370-
:target: ../../gallery/axisartist/axis_direction_demo_step03.html
371-
:align: center
372-
:scale: 50
373-
374-
Axis Direction Demo - Step 03
375-
376-
4. ticks are by default drawn toward the opposite direction of the ticklabels.
377-
378-
5. text rotation of ticklabels and label is determined in reference
379-
to the *ticklabel_direction* or *label_direction*,
380-
respectively. The rotation of ticklabels and label is anchored.
381-
382-
.. figure:: ../../gallery/axisartist/images/sphx_glr_axis_direction_demo_step04_001.png
383-
:target: ../../gallery/axisartist/axis_direction_demo_step04.html
384-
:align: center
385-
:scale: 50
386-
387-
Axis Direction Demo - Step 04
359+
.. figure:: ../../gallery/axisartist/images/sphx_glr_axis_direction_001.png
360+
:target: ../../gallery/axisartist/axis_direction.html
361+
:align: center
362+
:scale: 50
388363
389364
On the other hand, there is a concept of "axis_direction". This is a
390365
default setting of above properties for each, "bottom", "left", "top",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.