diff --git a/examples/userdemo/anchored_box04.py b/examples/userdemo/anchored_box04.py deleted file mode 100644 index 2a4a0f4cea07..000000000000 --- a/examples/userdemo/anchored_box04.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -============== -Anchored Box04 -============== - -""" -from matplotlib.patches import Ellipse -import matplotlib.pyplot as plt -from matplotlib.offsetbox import (AnchoredOffsetbox, DrawingArea, HPacker, - TextArea) - - -fig, ax = plt.subplots(figsize=(3, 3)) - -box1 = TextArea(" Test: ", textprops=dict(color="k")) - -box2 = DrawingArea(60, 20, 0, 0) -el1 = Ellipse((10, 10), width=16, height=5, angle=30, fc="r") -el2 = Ellipse((30, 10), width=16, height=5, angle=170, fc="g") -el3 = Ellipse((50, 10), width=16, height=5, angle=230, fc="b") -box2.add_artist(el1) -box2.add_artist(el2) -box2.add_artist(el3) - -box = HPacker(children=[box1, box2], - align="center", - pad=0, sep=5) - -anchored_box = AnchoredOffsetbox(loc='lower left', - child=box, pad=0., - frameon=True, - bbox_to_anchor=(0., 1.02), - bbox_transform=ax.transAxes, - borderpad=0., - ) - -ax.add_artist(anchored_box) - -fig.subplots_adjust(top=0.8) -plt.show() diff --git a/examples/userdemo/annotate_simple01.py b/examples/userdemo/annotate_simple01.py deleted file mode 100644 index 0376397d0cb7..000000000000 --- a/examples/userdemo/annotate_simple01.py +++ /dev/null @@ -1,19 +0,0 @@ -""" -================= -Annotate Simple01 -================= - -""" -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots(figsize=(3, 3)) - -ax.annotate("", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - arrowprops=dict(arrowstyle="->", - connectionstyle="arc3"), - ) - -plt.show() diff --git a/examples/userdemo/annotate_simple02.py b/examples/userdemo/annotate_simple02.py deleted file mode 100644 index 8ba7f51a1945..000000000000 --- a/examples/userdemo/annotate_simple02.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -================= -Annotate Simple02 -================= - -""" -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots(figsize=(3, 3)) - -ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - arrowprops=dict(arrowstyle="simple", - connectionstyle="arc3,rad=-0.2"), - ) - -plt.show() diff --git a/examples/userdemo/annotate_simple03.py b/examples/userdemo/annotate_simple03.py deleted file mode 100644 index c2d1c17b4aee..000000000000 --- a/examples/userdemo/annotate_simple03.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -================= -Annotate Simple03 -================= - -""" -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots(figsize=(3, 3)) - -ann = ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - bbox=dict(boxstyle="round4", fc="w"), - arrowprops=dict(arrowstyle="-|>", - connectionstyle="arc3,rad=-0.2", - fc="w"), - ) - -plt.show() diff --git a/examples/userdemo/annotate_simple04.py b/examples/userdemo/annotate_simple04.py deleted file mode 100644 index 7b0bff038b48..000000000000 --- a/examples/userdemo/annotate_simple04.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -================= -Annotate Simple04 -================= - -""" -import matplotlib.pyplot as plt - - -fig, ax = plt.subplots(figsize=(3, 3)) - -ann = ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - bbox=dict(boxstyle="round4", fc="w"), - arrowprops=dict(arrowstyle="-|>", - connectionstyle="arc3,rad=0.2", - relpos=(0., 0.), - fc="w"), - ) - -ann = ax.annotate("Test", - xy=(0.2, 0.2), xycoords='data', - xytext=(0.8, 0.8), textcoords='data', - size=20, va="center", ha="center", - bbox=dict(boxstyle="round4", fc="w"), - arrowprops=dict(arrowstyle="-|>", - connectionstyle="arc3,rad=-0.2", - relpos=(1., 0.), - fc="w"), - ) - -plt.show() diff --git a/examples/userdemo/annotate_simple_coord01.py b/examples/userdemo/annotate_simple_coord01.py deleted file mode 100644 index 71f2642ccaf0..000000000000 --- a/examples/userdemo/annotate_simple_coord01.py +++ /dev/null @@ -1,19 +0,0 @@ -""" -======================= -Annotate Simple Coord01 -======================= - -""" - -import matplotlib.pyplot as plt - -fig, ax = plt.subplots(figsize=(3, 2)) -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", - va="center", ha="center", - bbox=dict(boxstyle="round", fc="w")) -an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1, - xytext=(30, 0), textcoords="offset points", - va="center", ha="left", - bbox=dict(boxstyle="round", fc="w"), - arrowprops=dict(arrowstyle="->")) -plt.show() diff --git a/examples/userdemo/annotate_simple_coord03.py b/examples/userdemo/annotate_simple_coord03.py deleted file mode 100644 index 88f8668ebef6..000000000000 --- a/examples/userdemo/annotate_simple_coord03.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -======================= -Annotate Simple Coord03 -======================= - -""" - -import matplotlib.pyplot as plt -from matplotlib.text import OffsetFrom - - -fig, ax = plt.subplots(figsize=(3, 2)) -an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", - va="center", ha="center", - bbox=dict(boxstyle="round", fc="w")) - -offset_from = OffsetFrom(an1, (0.5, 0)) -an2 = ax.annotate("Test 2", xy=(0.1, 0.1), xycoords="data", - xytext=(0, -10), textcoords=offset_from, - # xytext is offset points from "xy=(0.5, 0), xycoords=an1" - va="top", ha="center", - bbox=dict(boxstyle="round", fc="w"), - arrowprops=dict(arrowstyle="->")) -plt.show() diff --git a/tutorials/text/annotations.py b/tutorials/text/annotations.py index 9dad089a2b43..6278f8d41b17 100644 --- a/tutorials/text/annotations.py +++ b/tutorials/text/annotations.py @@ -1,4 +1,12 @@ r""" +.. redirect-from:: /gallery/userdemo/annotate_simple01 +.. redirect-from:: /gallery/userdemo/annotate_simple02 +.. redirect-from:: /gallery/userdemo/annotate_simple03 +.. redirect-from:: /gallery/userdemo/annotate_simple04 +.. redirect-from:: /gallery/userdemo/anchored_box04 +.. redirect-from:: /gallery/userdemo/annotate_simple_coord01 +.. redirect-from:: /gallery/userdemo/annotate_simple_coord03 + Annotations =========== @@ -170,6 +178,7 @@ # # Placing text annotations relative to data # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# # Annotations can be positioned at a relative offset to the *xy* input to # annotation by setting the *textcoords* keyword argument to ``'offset points'`` # or ``'offset pixels'``.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: