diff --git a/examples/pylab_examples/annotation_demo.py b/examples/pylab_examples/annotation_demo.py index e58f9cac776f..5c3634aa4826 100644 --- a/examples/pylab_examples/annotation_demo.py +++ b/examples/pylab_examples/annotation_demo.py @@ -35,7 +35,7 @@ """ -from matplotlib.pyplot import figure, show +import matplotlib.pyplot as plt from matplotlib.patches import Ellipse import numpy as np @@ -43,7 +43,7 @@ if 1: # if only one location is given, the text and xypoint being # annotated are assumed to be the same - fig = figure() + fig = plt.figure() ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-3, 5)) t = np.arange(0.0, 5.0, 0.01) @@ -93,7 +93,7 @@ # example is placed in the fractional figure coordinate system. # Text keyword args like horizontal and vertical alignment are # respected - fig = figure() + fig = plt.figure() ax = fig.add_subplot(111, polar=True) r = np.arange(0, 1, 0.001) theta = 2*2*np.pi*r @@ -120,7 +120,7 @@ el = Ellipse((0, 0), 10, 20, facecolor='r', alpha=0.5) - fig = figure() + fig = plt.figure() ax = fig.add_subplot(111, aspect='equal') ax.add_artist(el) el.set_clip_box(ax.bbox) @@ -138,4 +138,4 @@ ax.set_xlim(-20, 20) ax.set_ylim(-20, 20) -show() +plt.show() diff --git a/examples/pylab_examples/annotation_demo2.py b/examples/pylab_examples/annotation_demo2.py index 3276a4d60d3f..0c2b357405fe 100644 --- a/examples/pylab_examples/annotation_demo2.py +++ b/examples/pylab_examples/annotation_demo2.py @@ -1,10 +1,10 @@ -from matplotlib.pyplot import figure, show +import matplotlib.pyplot as plt from matplotlib.patches import Ellipse import numpy as np if 1: - fig = figure(1, figsize=(8, 5)) + fig = plt.figure(1, figsize=(8, 5)) ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-4, 3)) t = np.arange(0.0, 5.0, 0.01) @@ -80,7 +80,7 @@ if 1: - fig = figure(2) + fig = plt.figure(2) fig.clf() ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1, 5), ylim=(-5, 3)) @@ -98,7 +98,7 @@ ax.annotate('fancy', xy=(2., -1), xycoords='data', xytext=(-100, 60), textcoords='offset points', size=20, - #bbox=dict(boxstyle="round", fc="0.8"), + # bbox=dict(boxstyle="round", fc="0.8"), arrowprops=dict(arrowstyle="fancy", fc="0.6", ec="none", patchB=el, @@ -108,7 +108,7 @@ ax.annotate('simple', xy=(2., -1), xycoords='data', xytext=(100, 60), textcoords='offset points', size=20, - #bbox=dict(boxstyle="round", fc="0.8"), + # bbox=dict(boxstyle="round", fc="0.8"), arrowprops=dict(arrowstyle="simple", fc="0.6", ec="none", patchB=el, @@ -118,7 +118,7 @@ ax.annotate('wedge', xy=(2., -1), xycoords='data', xytext=(-100, -100), textcoords='offset points', size=20, - #bbox=dict(boxstyle="round", fc="0.8"), + # bbox=dict(boxstyle="round", fc="0.8"), arrowprops=dict(arrowstyle="wedge,tail_width=0.7", fc="0.6", ec="none", patchB=el, @@ -150,4 +150,4 @@ ) -show() +plt.show()