From 67ec9e2e52873970b7a2615008204fab0d1fafb1 Mon Sep 17 00:00:00 2001 From: hannah Date: Mon, 1 May 2017 01:48:30 -0400 Subject: [PATCH 1/2] added link to basic_units.py, fixed bar chart link --- examples/units/README.txt | 2 ++ examples/units/annotate_with_units.py | 4 ++++ examples/units/artist_tests.py | 4 ++++ examples/units/bar_demo2.py | 3 +++ examples/units/bar_unit_demo.py | 9 ++++++--- examples/units/ellipse_with_units.py | 15 ++++++++------- examples/units/radian_demo.py | 7 ++++--- examples/units/units_sample.py | 4 ++++ examples/units/units_scatter.py | 8 ++++---- 9 files changed, 39 insertions(+), 17 deletions(-) diff --git a/examples/units/README.txt b/examples/units/README.txt index 7079b0edc47a..d465e6679979 100644 --- a/examples/units/README.txt +++ b/examples/units/README.txt @@ -1,5 +1,7 @@ .. _units_examples: +.. _units-examples-index: + Units in Matplotlib =================== diff --git a/examples/units/annotate_with_units.py b/examples/units/annotate_with_units.py index 67fea4584e2f..cd4e47ddaf12 100644 --- a/examples/units/annotate_with_units.py +++ b/examples/units/annotate_with_units.py @@ -6,7 +6,11 @@ The example illustrates how to create text and arrow annotations using a centimeter-scale plot. +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ + import matplotlib.pyplot as plt from basic_units import cm diff --git a/examples/units/artist_tests.py b/examples/units/artist_tests.py index 05ca5ca1de29..0b078ce5cb6f 100644 --- a/examples/units/artist_tests.py +++ b/examples/units/artist_tests.py @@ -9,6 +9,10 @@ parent. You must initialize the artists with the axis instance if you want to use them with unit data, or else they will not know how to convert the units to scalars. + +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ import random import matplotlib.lines as lines diff --git a/examples/units/bar_demo2.py b/examples/units/bar_demo2.py index d956c1760bd3..d18f81b77535 100644 --- a/examples/units/bar_demo2.py +++ b/examples/units/bar_demo2.py @@ -9,6 +9,9 @@ set the xlimits using scalars (ax3, current units assumed) or units (conversions applied to get the numbers to current units). +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ import numpy as np from basic_units import cm, inch diff --git a/examples/units/bar_unit_demo.py b/examples/units/bar_unit_demo.py index 1e275cbd2c79..c6c6499737db 100644 --- a/examples/units/bar_unit_demo.py +++ b/examples/units/bar_unit_demo.py @@ -3,9 +3,12 @@ Group barchart with units ========================= -This is the same example as - -the barchart demo in centimeters. +This is the same example as :doc:`the barchart demo<../api/barchart>` +the barchart demo in centimeters. + +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ import numpy as np diff --git a/examples/units/ellipse_with_units.py b/examples/units/ellipse_with_units.py index d3cddd52a884..7602f8d3aa8a 100644 --- a/examples/units/ellipse_with_units.py +++ b/examples/units/ellipse_with_units.py @@ -4,6 +4,10 @@ ================== Compare the ellipse generated with arcs versus a polygonal approximation + +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ from basic_units import cm import numpy as np @@ -12,7 +16,6 @@ xcenter, ycenter = 0.38*cm, 0.52*cm -#xcenter, ycenter = 0., 0. width, height = 1e-1*cm, 3e-1*cm angle = -30 @@ -33,7 +36,8 @@ fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') -ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) +ax.fill(x, y, alpha=0.2, facecolor='yellow', + edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Ellipse((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) @@ -47,13 +51,12 @@ ax.add_patch(e2) - -#fig.savefig('ellipse_compare.png') fig.savefig('ellipse_compare') fig = plt.figure() ax = fig.add_subplot(211, aspect='auto') -ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) +ax.fill(x, y, alpha=0.2, facecolor='yellow', + edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Arc((xcenter, ycenter), width, height, angle=angle, linewidth=2, fill=False, zorder=2) @@ -67,8 +70,6 @@ ax.add_patch(e2) - -#fig.savefig('arc_compare.png') fig.savefig('arc_compare') plt.show() diff --git a/examples/units/radian_demo.py b/examples/units/radian_demo.py index 5b0d010c1544..bd4980ffe297 100644 --- a/examples/units/radian_demo.py +++ b/examples/units/radian_demo.py @@ -3,10 +3,11 @@ Radian ticks ============ -Plot with radians from the basic_units mockup example package. +Plot using radian units. -This example shows how the unit class can determine the tick locating, -formatting and axis labeling. +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ import numpy as np from basic_units import radians, degrees, cos diff --git a/examples/units/units_sample.py b/examples/units/units_sample.py index 3057dbe05a0d..dfa2333d7dc3 100644 --- a/examples/units/units_sample.py +++ b/examples/units/units_sample.py @@ -8,6 +8,10 @@ `plot` function. Note that conversions are applied to get numbers to correct units. +.. only:: builder_html + + This example requires :download:`basic_units.py ` + """ from basic_units import cm, inch import matplotlib.pyplot as plt diff --git a/examples/units/units_scatter.py b/examples/units/units_scatter.py index 4723369943cf..7850adef7e33 100644 --- a/examples/units/units_scatter.py +++ b/examples/units/units_scatter.py @@ -3,12 +3,12 @@ Unit handling ============= -basic_units is a mockup of a true units package used for testing -purposed, which illustrates the basic interface that a units package -must provide to matplotlib. - The example below shows support for unit conversions over masked arrays. + +.. only:: builder_html + + This example requires :download:`basic_units.py ` """ import numpy as np import matplotlib.pyplot as plt From 74ef9be67c198510ea54e3b61831d4284d24ea0c Mon Sep 17 00:00:00 2001 From: hannah Date: Mon, 1 May 2017 02:03:52 -0400 Subject: [PATCH 2/2] fixed doubling in prose --- examples/units/bar_unit_demo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/units/bar_unit_demo.py b/examples/units/bar_unit_demo.py index c6c6499737db..a4f0bdf17612 100644 --- a/examples/units/bar_unit_demo.py +++ b/examples/units/bar_unit_demo.py @@ -4,7 +4,7 @@ ========================= This is the same example as :doc:`the barchart demo<../api/barchart>` -the barchart demo in centimeters. +in centimeters. .. only:: builder_html