From b533050513911903c11e001823dcd2bff20248ad Mon Sep 17 00:00:00 2001 From: Irtaza Khalid Date: Sat, 4 Feb 2023 15:49:35 +0000 Subject: [PATCH 1/2] added redirects in annotations.py header and deleted redundant annotate_* examples in gallery/userdemo --- examples/userdemo/anchored_box04.py | 40 -------------------- examples/userdemo/annotate_simple01.py | 19 ---------- examples/userdemo/annotate_simple02.py | 20 ---------- examples/userdemo/annotate_simple03.py | 22 ----------- examples/userdemo/annotate_simple04.py | 34 ----------------- examples/userdemo/annotate_simple_coord01.py | 19 ---------- examples/userdemo/annotate_simple_coord03.py | 24 ------------ tutorials/text/annotations.py | 8 ++++ 8 files changed, 8 insertions(+), 178 deletions(-) delete mode 100644 examples/userdemo/anchored_box04.py delete mode 100644 examples/userdemo/annotate_simple01.py delete mode 100644 examples/userdemo/annotate_simple02.py delete mode 100644 examples/userdemo/annotate_simple03.py delete mode 100644 examples/userdemo/annotate_simple04.py delete mode 100644 examples/userdemo/annotate_simple_coord01.py delete mode 100644 examples/userdemo/annotate_simple_coord03.py 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..78f10fd1ccab 100644 --- a/tutorials/text/annotations.py +++ b/tutorials/text/annotations.py @@ -1,4 +1,11 @@ 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 +177,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'``. From 805d9527787c4b948a42b0daaa6577f2f79b2cd6 Mon Sep 17 00:00:00 2001 From: Irtaza Khalid Date: Mon, 6 Feb 2023 15:16:29 +0000 Subject: [PATCH 2/2] add space beneath redirectives --- tutorials/text/annotations.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tutorials/text/annotations.py b/tutorials/text/annotations.py index 78f10fd1ccab..6278f8d41b17 100644 --- a/tutorials/text/annotations.py +++ b/tutorials/text/annotations.py @@ -6,6 +6,7 @@ .. redirect-from:: /gallery/userdemo/anchored_box04 .. redirect-from:: /gallery/userdemo/annotate_simple_coord01 .. redirect-from:: /gallery/userdemo/annotate_simple_coord03 + Annotations =========== pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy