From 5670b0a96cad53ff3f44985d8fb00a1fffe5713c Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 7 Mar 2017 20:18:55 +0000 Subject: [PATCH 1/3] MEP12 alignment_test --- examples/pylab_examples/alignment_test.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/pylab_examples/alignment_test.py b/examples/pylab_examples/alignment_test.py index 5de0d6a33a48..6e5ccf246648 100644 --- a/examples/pylab_examples/alignment_test.py +++ b/examples/pylab_examples/alignment_test.py @@ -1,22 +1,24 @@ """ +=================== +Precise text layout +=================== + You can precisely layout text in data or axes (0,1) coordinates. This example shows you some of the alignment and rotation specifications to -layout text +layout text. """ import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.patches import Rectangle -# build a rectangle in axes coords +# Build a rectangle in axes coords left, width = .25, .5 bottom, height = .25, .5 right = left + width top = bottom + height ax = plt.gca() -p = plt.Rectangle((left, bottom), width, height, - fill=False, - ) +p = plt.Rectangle((left, bottom), width, height, fill=False) p.set_transform(ax.transAxes) p.set_clip_on(False) ax.add_patch(p) @@ -47,24 +49,24 @@ verticalalignment='top', transform=ax.transAxes) -ax.text(left, 0.5*(bottom + top), 'right center', +ax.text(left, 0.5 * (bottom + top), 'right center', horizontalalignment='right', verticalalignment='center', rotation='vertical', transform=ax.transAxes) -ax.text(left, 0.5*(bottom + top), 'left center', +ax.text(left, 0.5 * (bottom + top), 'left center', horizontalalignment='left', verticalalignment='center', rotation='vertical', transform=ax.transAxes) -ax.text(0.5*(left + right), 0.5*(bottom + top), 'middle', +ax.text(0.5 * (left + right), 0.5 * (bottom + top), 'middle', horizontalalignment='center', verticalalignment='center', transform=ax.transAxes) -ax.text(right, 0.5*(bottom + top), 'centered', +ax.text(right, 0.5 * (bottom + top), 'centered', horizontalalignment='center', verticalalignment='center', rotation='vertical', From 97068ebe2cd47c54d1f7d605a132da781a825e56 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 7 Mar 2017 20:19:27 +0000 Subject: [PATCH 2/3] Move alignment_test example --- .../text_alignment.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{pylab_examples/alignment_test.py => text_labels_and_annotations/text_alignment.py} (100%) diff --git a/examples/pylab_examples/alignment_test.py b/examples/text_labels_and_annotations/text_alignment.py similarity index 100% rename from examples/pylab_examples/alignment_test.py rename to examples/text_labels_and_annotations/text_alignment.py From 27c9686196efac1a6d845bfbfbc13ee9b98b5229 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 8 Mar 2017 09:30:36 +0000 Subject: [PATCH 3/3] Clean up description wording --- examples/text_labels_and_annotations/text_alignment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/text_labels_and_annotations/text_alignment.py b/examples/text_labels_and_annotations/text_alignment.py index 6e5ccf246648..2503440c3277 100644 --- a/examples/text_labels_and_annotations/text_alignment.py +++ b/examples/text_labels_and_annotations/text_alignment.py @@ -4,8 +4,8 @@ =================== You can precisely layout text in data or axes (0,1) coordinates. This -example shows you some of the alignment and rotation specifications to -layout text. +example shows you some of the alignment and rotation specifications for text +layout. """ import matplotlib.pyplot as plt