From 1a0717adc4c4b1b33a3c276cd230ab5990f82bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 10 Aug 2025 20:07:15 +0200 Subject: [PATCH 1/8] Add content for reference and anchor points --- doc/techref/index.md | 1 + doc/techref/reference_anchor_points.md | 53 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 doc/techref/reference_anchor_points.md diff --git a/doc/techref/index.md b/doc/techref/index.md index 9d6367ac055..8cbfe04cea7 100644 --- a/doc/techref/index.md +++ b/doc/techref/index.md @@ -14,5 +14,6 @@ fonts.md text_formatting.md patterns.md encodings.md +reference_anchor_points.md environment_variables.md ``` diff --git a/doc/techref/reference_anchor_points.md b/doc/techref/reference_anchor_points.md new file mode 100755 index 00000000000..b9e01b9b96d --- /dev/null +++ b/doc/techref/reference_anchor_points.md @@ -0,0 +1,53 @@ +--- +file_format: mystnb +--- + +# Reference and anchor points + +xxx + +```{code-cell} +--- +tags: [remove-input] +--- +""" +Script explaining reference and anchor points. +""" +import pygmt + +size = 5 +x1 = [-size, 0, size, size, size, 0, -size, -size, 0] +y1 = [-size, -size, -size, 0, size, size, size, 0, 0] +x2 = [-3, -2, -1, -1, -1, -2, -3, -3, -2] +y2 = [-1, -1, -1, 0, 1, 1, 1, 0, 0] +codes = ["BL", "BC", "BR", "MR", "TR", "TC", "TL", "ML", "MC"] + +fig = pygmt.Figure() +fig.basemap(projection="X10c/6c", region=[-size, size, -size, size], frame=0) + +fig.text( + text=codes, + x=x1, + y=y1, + justify=codes, + offset="j0.5c/0.2c+v1p,gray30", + font="10p,1,black", +) + +fig.plot(x=x2[0:-1], y=y2[0:-1], fill="bisque") + +fig.plot(x=-size, y=size, style="s0.6c", fill="lightred", no_clip=True) +fig.plot(x=x1, y=y1, style="c0.25c", fill="steelblue", no_clip=True) + +fig.plot(x=-3, y=1, style="s0.6c", fill="orange") +fig.plot(x=x2, y=y2, style="c0.15c", fill="darkblue") + +fig.plot(x=[-5, -3], y=[5, 1], pen="0.5p,black") +fig.plot(x=[-5, -3], y=[1, 1], pen="0.5p,black,2_2") +fig.plot(x=[-3, -3], y=[1, 5], pen="0.5p,black,2_2") + +fig.text(x=-4, y=1, text="dx", offset="0c/0.2c") +fig.text(x=-3, y=3, text="dy", offset="-0.2c/0c") + +fig.show(width=600) +``` From 93346ea8c525f1f21f5bd72163a6965aeb446c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Sun, 10 Aug 2025 20:14:22 +0200 Subject: [PATCH 2/8] Remove execution permission --- doc/techref/reference_anchor_points.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 doc/techref/reference_anchor_points.md diff --git a/doc/techref/reference_anchor_points.md b/doc/techref/reference_anchor_points.md old mode 100755 new mode 100644 From e0e84e96fcba56be4fbfa33b46015ce4fe5c6330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 13 Aug 2025 21:24:10 +0200 Subject: [PATCH 3/8] Add docs --- doc/techref/reference_anchor_points.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/techref/reference_anchor_points.md b/doc/techref/reference_anchor_points.md index b9e01b9b96d..7dff3f86b35 100644 --- a/doc/techref/reference_anchor_points.md +++ b/doc/techref/reference_anchor_points.md @@ -4,7 +4,9 @@ file_format: mystnb # Reference and anchor points -xxx +For placing plot embellishments we distinguish between reference and anchor points. +To set these points users have to use the justification codes (add link when PR merged). +The `offset` parameter allows to offset the anchor point from the reference point. ```{code-cell} --- From cbbdf67d22aa3cb885fd1ef766cc5be50fa5a738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 13 Aug 2025 21:24:45 +0200 Subject: [PATCH 4/8] Use Unix LF line ending --- doc/techref/reference_anchor_points.md | 110 ++++++++++++------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/doc/techref/reference_anchor_points.md b/doc/techref/reference_anchor_points.md index 7dff3f86b35..36f6e65aef7 100644 --- a/doc/techref/reference_anchor_points.md +++ b/doc/techref/reference_anchor_points.md @@ -1,55 +1,55 @@ ---- -file_format: mystnb ---- - -# Reference and anchor points - -For placing plot embellishments we distinguish between reference and anchor points. -To set these points users have to use the justification codes (add link when PR merged). -The `offset` parameter allows to offset the anchor point from the reference point. - -```{code-cell} ---- -tags: [remove-input] ---- -""" -Script explaining reference and anchor points. -""" -import pygmt - -size = 5 -x1 = [-size, 0, size, size, size, 0, -size, -size, 0] -y1 = [-size, -size, -size, 0, size, size, size, 0, 0] -x2 = [-3, -2, -1, -1, -1, -2, -3, -3, -2] -y2 = [-1, -1, -1, 0, 1, 1, 1, 0, 0] -codes = ["BL", "BC", "BR", "MR", "TR", "TC", "TL", "ML", "MC"] - -fig = pygmt.Figure() -fig.basemap(projection="X10c/6c", region=[-size, size, -size, size], frame=0) - -fig.text( - text=codes, - x=x1, - y=y1, - justify=codes, - offset="j0.5c/0.2c+v1p,gray30", - font="10p,1,black", -) - -fig.plot(x=x2[0:-1], y=y2[0:-1], fill="bisque") - -fig.plot(x=-size, y=size, style="s0.6c", fill="lightred", no_clip=True) -fig.plot(x=x1, y=y1, style="c0.25c", fill="steelblue", no_clip=True) - -fig.plot(x=-3, y=1, style="s0.6c", fill="orange") -fig.plot(x=x2, y=y2, style="c0.15c", fill="darkblue") - -fig.plot(x=[-5, -3], y=[5, 1], pen="0.5p,black") -fig.plot(x=[-5, -3], y=[1, 1], pen="0.5p,black,2_2") -fig.plot(x=[-3, -3], y=[1, 5], pen="0.5p,black,2_2") - -fig.text(x=-4, y=1, text="dx", offset="0c/0.2c") -fig.text(x=-3, y=3, text="dy", offset="-0.2c/0c") - -fig.show(width=600) -``` +--- +file_format: mystnb +--- + +# Reference and anchor points + +For placing plot embellishments we distinguish between reference and anchor points. +To set these points users have to use the justification codes (add link when PR merged). +The `offset` parameter allows to offset the anchor point from the reference point. + +```{code-cell} +--- +tags: [remove-input] +--- +""" +Script explaining reference and anchor points. +""" +import pygmt + +size = 5 +x1 = [-size, 0, size, size, size, 0, -size, -size, 0] +y1 = [-size, -size, -size, 0, size, size, size, 0, 0] +x2 = [-3, -2, -1, -1, -1, -2, -3, -3, -2] +y2 = [-1, -1, -1, 0, 1, 1, 1, 0, 0] +codes = ["BL", "BC", "BR", "MR", "TR", "TC", "TL", "ML", "MC"] + +fig = pygmt.Figure() +fig.basemap(projection="X10c/6c", region=[-size, size, -size, size], frame=0) + +fig.text( + text=codes, + x=x1, + y=y1, + justify=codes, + offset="j0.5c/0.2c+v1p,gray30", + font="10p,1,black", +) + +fig.plot(x=x2[0:-1], y=y2[0:-1], fill="bisque") + +fig.plot(x=-size, y=size, style="s0.6c", fill="lightred", no_clip=True) +fig.plot(x=x1, y=y1, style="c0.25c", fill="steelblue", no_clip=True) + +fig.plot(x=-3, y=1, style="s0.6c", fill="orange") +fig.plot(x=x2, y=y2, style="c0.15c", fill="darkblue") + +fig.plot(x=[-5, -3], y=[5, 1], pen="0.5p,black") +fig.plot(x=[-5, -3], y=[1, 1], pen="0.5p,black,2_2") +fig.plot(x=[-3, -3], y=[1, 5], pen="0.5p,black,2_2") + +fig.text(x=-4, y=1, text="dx", offset="0c/0.2c") +fig.text(x=-3, y=3, text="dy", offset="-0.2c/0c") + +fig.show(width=600) +``` From 033e7d35003f56c4aed5aaceddc85b874d353399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 3 Sep 2025 12:15:10 +0200 Subject: [PATCH 5/8] Link to justification code page --- doc/techref/justification_codes.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/techref/justification_codes.md b/doc/techref/justification_codes.md index 671d63f30e9..5a6e85e8526 100644 --- a/doc/techref/justification_codes.md +++ b/doc/techref/justification_codes.md @@ -5,10 +5,11 @@ file_format: mystnb # Justification codes To place plot embellishments, such as scalebars, directional roses, colorbars, legends, -text, or images on a figure, two points have to be specified: a point somewhere on the -figure (**reference point**) and a point on the feature (**anchor point**). For both, -users can use a two-character code, a combination of a vertical code and a horizontal -code (order-independent): +text, or images on a figure, two points have to be specified (for details please see +:doc:`Reference and anchor points `) a point somewhere +on the figure (**reference point**) and a point on the feature (**anchor point**). For both, +users can use a two-character code, a combination of a vertical code and a horizontal code +(order-independent): - Vertical: **T**(op), **M**(iddle), **B**(ottom) - Horizontal: **L**(eft), **C**(entre), **R**(ight) From 57a0ed5d3df54781f10358fb1ab9b31fe878d369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 3 Sep 2025 12:18:31 +0200 Subject: [PATCH 6/8] Add links to ref pages --- doc/techref/justification_codes.md | 2 +- doc/techref/reference_anchor_points.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/techref/justification_codes.md b/doc/techref/justification_codes.md index 5a6e85e8526..e3fc129b691 100644 --- a/doc/techref/justification_codes.md +++ b/doc/techref/justification_codes.md @@ -6,7 +6,7 @@ file_format: mystnb To place plot embellishments, such as scalebars, directional roses, colorbars, legends, text, or images on a figure, two points have to be specified (for details please see -:doc:`Reference and anchor points `) a point somewhere +:doc:`Reference and anchor points `) a point somewhere on the figure (**reference point**) and a point on the feature (**anchor point**). For both, users can use a two-character code, a combination of a vertical code and a horizontal code (order-independent): diff --git a/doc/techref/reference_anchor_points.md b/doc/techref/reference_anchor_points.md index 36f6e65aef7..35d1cc968b5 100644 --- a/doc/techref/reference_anchor_points.md +++ b/doc/techref/reference_anchor_points.md @@ -4,8 +4,8 @@ file_format: mystnb # Reference and anchor points -For placing plot embellishments we distinguish between reference and anchor points. -To set these points users have to use the justification codes (add link when PR merged). +For placing plot embellishments, we distinguish between reference and anchor points. +To set these points users have to use the :doc:`justification codes `. The `offset` parameter allows to offset the anchor point from the reference point. ```{code-cell} From 3232e8cbe6e47db5baeb2a20def8bf1d0f1b011a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 3 Sep 2025 12:57:52 +0200 Subject: [PATCH 7/8] Use correct synthax for links --- doc/techref/justification_codes.md | 2 +- doc/techref/reference_anchor_points.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/techref/justification_codes.md b/doc/techref/justification_codes.md index e3fc129b691..be2324cab00 100644 --- a/doc/techref/justification_codes.md +++ b/doc/techref/justification_codes.md @@ -6,7 +6,7 @@ file_format: mystnb To place plot embellishments, such as scalebars, directional roses, colorbars, legends, text, or images on a figure, two points have to be specified (for details please see -:doc:`Reference and anchor points `) a point somewhere +[Reference and anchor points](/techref/reference_anchor_points.md) a point somewhere on the figure (**reference point**) and a point on the feature (**anchor point**). For both, users can use a two-character code, a combination of a vertical code and a horizontal code (order-independent): diff --git a/doc/techref/reference_anchor_points.md b/doc/techref/reference_anchor_points.md index 35d1cc968b5..4667d4e2fea 100644 --- a/doc/techref/reference_anchor_points.md +++ b/doc/techref/reference_anchor_points.md @@ -4,8 +4,8 @@ file_format: mystnb # Reference and anchor points -For placing plot embellishments, we distinguish between reference and anchor points. -To set these points users have to use the :doc:`justification codes `. +For placing plot embellishments, we distinguish between reference and anchor points. To set +these points users have to use the [justification codes](/techref/justification_codes.md). The `offset` parameter allows to offset the anchor point from the reference point. ```{code-cell} From 854cf48e76df0116b24834ef0e9015215417d55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Wed, 3 Sep 2025 13:10:58 +0200 Subject: [PATCH 8/8] Adjust formulation --- doc/techref/justification_codes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/techref/justification_codes.md b/doc/techref/justification_codes.md index be2324cab00..6f9bf19fdd1 100644 --- a/doc/techref/justification_codes.md +++ b/doc/techref/justification_codes.md @@ -5,9 +5,9 @@ file_format: mystnb # Justification codes To place plot embellishments, such as scalebars, directional roses, colorbars, legends, -text, or images on a figure, two points have to be specified (for details please see -[Reference and anchor points](/techref/reference_anchor_points.md) a point somewhere -on the figure (**reference point**) and a point on the feature (**anchor point**). For both, +text, or images on a figure, two points have to be specified a point somewhere on the +figure (**reference point**) and a point on the feature (**anchor point**); for details +please see [Reference and anchor points](/techref/reference_anchor_points.md). For both, users can use a two-character code, a combination of a vertical code and a horizontal code (order-independent):