8000 Merge pull request #8554 from story645/unit_docs · matplotlib/matplotlib@dc9c93d · GitHub
[go: up one dir, main page]

Skip to content

Commit dc9c93d

Browse files
authored
Merge pull request #8554 from story645/unit_docs
added basic_units download link to units examples
2 parents a9a8634 + 74ef9be commit dc9c93d

File tree

9 files changed

+39
-17
lines changed

9 files changed

+39
-17
lines changed

examples/units/README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.. _units_examples:
22

3+
.. _units-examples-index:
4+
35
Units in Matplotlib
46
===================
57

examples/units/annotate_with_units.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
The example illustrates how to create text and arrow
77
annotations using a centimeter-scale plot.
88
9+
.. only:: builder_html
10+
11+
This example requires :download:`basic_units.py <basic_units.py>`
912
"""
13+
1014
import matplotlib.pyplot as plt
1115
from basic_units import cm
1216

examples/units/artist_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
parent. You must initialize the artists with the axis instance if you want to
1010
use them with unit data, or else they will not know how to convert the units
1111
to scalars.
12+
13+
.. only:: builder_html
14+
15+
This example requires :download:`basic_units.py <basic_units.py>`
1216
"""
1317
import random
1418
import matplotlib.lines as lines

examples/units/bar_demo2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
set the xlimits using scalars (ax3, current units assumed) or units
1010
(conversions applied to get the numbers to current units).
1111
12+
.. only:: builder_html
13+
14+
This example requires :download:`basic_units.py <basic_units.py>`
1215
"""
1316
import numpy as np
1417
from basic_units import cm, inch

examples/units/bar_unit_demo.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
Group barchart with units
44
=========================
55
6-
This is the same example as
7-
<a href='http://matplotlib.org/examples/api/barchart_demo.html'>
8-
the barchart demo</a> in centimeters.
6+
This is the same example as :doc:`the barchart demo<../api/barchart>`
7+
in centimeters.
8+
9+
.. only:: builder_html
10+
11+
This example requires :download:`basic_units.py <basic_units.py>`
912
"""
1013

1114
import numpy as np

examples/units/ellipse_with_units.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
==================
55
66
Compare the ellipse generated with arcs versus a polygonal approximation
7+
8+
.. only:: builder_html
9+
10+
This example requires :download:`basic_units.py <basic_units.py>`
711
"""
812
from basic_units import cm
913
import numpy as np
@@ -12,7 +16,6 @@
1216

1317

1418
xcenter, ycenter = 0.38*cm, 0.52*cm
15-
#xcenter, ycenter = 0., 0.
1619
width, height = 1e-1*cm, 3e-1*cm
1720
angle = -30
1821

@@ -33,7 +36,8 @@
3336

3437
fig = plt.figure()
3538
ax = fig.add_subplot(211, aspect='auto')
36-
ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
39+
ax.fill(x, y, alpha=0.2, facecolor='yellow',
40+
edgecolor='yellow', linewidth=1, zorder=1)
3741

3842
e1 = patches.Ellipse((xcenter, ycenter), width, height,
3943
angle=angle, linewidth=2, fill=False, zorder=2)
@@ -47,13 +51,12 @@
4751

4852

4953
ax.add_patch(e2)
50-
51-
#fig.savefig('ellipse_compare.png')
5254
fig.savefig('ellipse_compare')
5355

5456
fig = plt.figure()
5557
ax = fig.add_subplot(211, aspect='auto')
56-
ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1)
58+
ax.fill(x, y, alpha=0.2, facecolor='yellow',
59+
edgecolor='yellow', linewidth=1, zorder=1)
5760

5861
e1 = patches.Arc((xcenter, ycenter), width, height,
5962
angle=angle, linewidth=2, fill=False, zorder=2)
@@ -67,8 +70,6 @@
6770

6871

6972
ax.add_patch(e2)
70-
71-
#fig.savefig('arc_compare.png')
7273
fig.savefig('arc_compare')
7374

7475
plt.show()

examples/units/radian_demo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
Radian ticks
44
============
55
6-
Plot with radians from the basic_units mockup example package.
6+
Plot using radian units.
77
8-
This example shows how the unit class can determine the tick locating,
9-
formatting and axis labeling.
8+
.. only:: builder_html
9+
10+
This example requires :download:`basic_units.py <basic_units.py>`
1011
"""
1112
import numpy as np
1213
from basic_units import radians, degrees, cos

examples/units/units_sample.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
`plot` function. Note that conversions are applied to get numbers to correct
99
units.
1010
11+
.. only:: builder_html
12+
13+
This example requires :download:`basic_units.py <basic_units.py>`
14+
1115
"""
1216
from basic_units import cm, inch
1317
import matplotlib.pyplot as plt

examples/units/units_scatter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Unit handling
44
=============
55
6-
basic_units is a mockup of a true units package used for testing
7-
purposed, which illustrates the basic interface that a units package
8-
must provide to matplotlib.
9-
106
The example below shows support for unit conversions over masked
117
arrays.
8+
9+
.. only:: builder_html
10+
11+
This example requires :download:`basic_units.py <basic_units.py>`
1212
"""
1313
import numpy as np
1414
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)
0