-
Notifications
You must be signed in to change notification settings - Fork 230
DOC: Add Technical Reference page for justification codes #4028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 50 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
176fcab
Add first ideas for Technical Reference page for justification codes
yvonnefroehlich 34d4409
Remove execution permission
yvonnefroehlich 9e493a2
Update
yvonnefroehlich 2a222cf
Focus on two-letter codes
yvonnefroehlich e591ac2
Adjust docs
yvonnefroehlich 9e86f47
Merge branch 'main' into add-techref-justify
yvonnefroehlich 80c3400
Add code for sektch to explain justification codes
yvonnefroehlich f8487d1
Merge remote-tracking branch 'origin/add-techref-justify' into add-te…
yvonnefroehlich e8e2441
Split script
yvonnefroehlich 83ba9e4
Merge branch 'main' into add-techref-justify
yvonnefroehlich 14234fc
Add sketch for reference and anchor point
yvonnefroehlich b119946
Adjust cmap for better contrast
yvonnefroehlich 06fadae
Adjust cmap for better contrast
yvonnefroehlich 5bd36a3
Adjust font size
yvonnefroehlich 839054b
No equal offsets in x and y directions
yvonnefroehlich 4267fe3
Use consistent order in justification codes
yvonnefroehlich cad5a02
Merge branch 'main' into add-techref-justify
yvonnefroehlich b59e858
Improve docs
yvonnefroehlich 29e07bd
Try defining variables ones
yvonnefroehlich 0303e69
Add docs
yvonnefroehlich e1656bb
Move content for reference and anchor point to seperate file
yvonnefroehlich c5cf5a8
Update index
yvonnefroehlich b7076a7
Add import and variable definitions
yvonnefroehlich 6bc3389
Use Unix LF
yvonnefroehlich 0ce44f8
Remove execution permission
yvonnefroehlich 6ea139d
Merge branch 'main' into add-techref-justify
yvonnefroehlich 573ebd2
Merge remote-tracking branch 'origin' into add-techref-justify
yvonnefroehlich 9534828
Merge remote-tracking branch 'origin/add-techref-justify' into add-te…
yvonnefroehlich e29f5e6
Merge branch 'main' into add-techref-justify
yvonnefroehlich 47dc728
Merge remote-tracking branch 'origin/add-techref-justify' into add-te…
yvonnefroehlich 786b014
Adjust colormap
yvonnefroehlich 2ef345c
Merge branch 'main' into add-techref-justify
yvonnefroehlich 873a1ba
Remove reference anchor points content
yvonnefroehlich 952624d
Merge branch 'main' into add-techref-justify
yvonnefroehlich 4233f32
Remove unneeded variables
yvonnefroehlich d827aec
Adjust docs
yvonnefroehlich 06f3347
Merge branch 'main' into add-techref-justify
yvonnefroehlich b63f97f
Merge branch 'main' into add-techref-justify
yvonnefroehlich efcaa71
Merge branch 'main' into add-techref-justify
yvonnefroehlich 1c45456
Merge branch 'main' into add-techref-justify
yvonnefroehlich 04f7fcc
TEST: list for alias needs at least two enteries
yvonnefroehlich a39d10d
TEST: Revert
yvonnefroehlich c1b9227
TEST: Copy list from coast method
yvonnefroehlich cdafedd
Merge branch 'main' into add-techref-justify
yvonnefroehlich 8fe356d
Merge branch 'main' into add-techref-justify
yvonnefroehlich c00369b
Improve docs
yvonnefroehlich fe324a4
Update formulation
yvonnefroehlich 7027cd0
Merge branch 'main' into add-techref-justify
yvonnefroehlich 16e7a40
TEST: remove gallery example linestrings
yvonnefroehlich 4f72189
Revert "TEST: remove gallery example linestrings"
yvonnefroehlich 145eb1b
Merge branch 'main' into add-techref-justify
yvonnefroehlich 9c6275b
Merge branch 'main' into add-techref-justify
yvonnefroehlich 2e22067
Merge branch 'main' into add-techref-justify
yvonnefroehlich 239036f
Link to techref in docs
yvonnefroehlich 38d8c85
Fix indent
yvonnefroehlich e8b8fd7
Mention techref in gallery examples and tutorials
yvonnefroehlich 0243529
Remove blank line
yvonnefroehlich 3dbcacc
Mention techref in docs
yvonnefroehlich 4322793
Merge branch 'main' into add-techref-justify
yvonnefroehlich 1f0318c
Merge branch 'main' into add-techref-justify
yvonnefroehlich 6fbefa3
Improve formulation
yvonnefroehlich 6e79fcb
Add justification code example
yvonnefroehlich 0f1120e
Highlight points in bold
yvonnefroehlich d37f3dc
Improve formulation
yvonnefroehlich 10d94ea
No need to escape
yvonnefroehlich a06ad41
Add blank line
yvonnefroehlich b6cab8c
Add blank line
yvonnefroehlich e8d0602
Use line length
yvonnefroehlich dd648cf
Add blank line
yvonnefroehlich a930970
Add more information
yvonnefroehlich 10cd6f3
Remove one blank line
yvonnefroehlich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ fonts.md | |
text_formatting.md | ||
patterns.md | ||
encodings.md | ||
justification_codes.md | ||
environment_variables.md | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
--- | ||
file_format: mystnb | ||
--- | ||
|
||
# Justification codes | ||
|
||
To place plot embellishments, such as scalebars, directional roses, colorbars, | ||
legends, text, and images on a figure two points have to be specified: a point | ||
yvonnefroehlich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
somewhere on the figure (reference point) and a point on the feature (anchor | ||
point). For both, users can use a two-character (order-independent) code, a | ||
combination of a vertical code and a horizontal code: | ||
|
||
|
||
- Vertical: **T**\(op), **M**\(iddle), **B**\(ottom) | ||
- Horizontal: **L**\(eft), **C**\(entre), **R**\(ight) | ||
yvonnefroehlich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
yvonnefroehlich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The possible nine justification codes are visualized in the sketch below: | ||
|
||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
""" | ||
Script showing the justification codes used in GMT / PyGMT. | ||
""" | ||
import pygmt | ||
|
||
size = 5 | ||
x1 = [-size, 0, size, size, size, 0, -size, -size, 0] | ||
y1 = [-size, -size, -size, 0, size, size, size, 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( | ||
font="15p,1,black", | ||
x=x1, | ||
y=y1, | ||
text=codes, | ||
justify=codes, | ||
offset="j0.5c/0.5c+v2p,gray30", | ||
) | ||
|
||
fig.plot(x=x1, y=y1, style="c0.3c", fill="steelblue", no_clip=True) | ||
|
||
fig.text( | ||
font="15p", | ||
offset="j0.5c/0.5c", | ||
no_clip=True, | ||
x=[size, size, size, -size, 0, size], | ||
y=[size, 0, -size, size, size, size], | ||
justify=["ML", "ML", "ML", "BC", "BC", "BC"], | ||
text=[ | ||
"@%1%T@%%op", | ||
"@%1%M@%%iddle", | ||
"@%1%B@%%ottom", | ||
"@%1%L@%%eft", | ||
"@%1%C@%%enter", | ||
"@%1%R@%%ight", | ||
], | ||
) | ||
|
||
fig.show(width=600) | ||
``` | ||
|
||
For a non-rectangular geographic basemap, the justification codes refer to the map | ||
bounding box: | ||
yvonnefroehlich marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
""" | ||
Script showing justification codes for non-rectangular geographic basemaps. | ||
""" | ||
fig = pygmt.Figure() | ||
fig.basemap(projection="H10c", region="g", frame=0) | ||
|
||
for code in codes: | ||
fig.text( | ||
font="10p,1,black", | ||
position=code, | ||
justify=code, | ||
text=code, | ||
offset="j0.5c/0.5c+v2p,gray30", | ||
) | ||
fig.text(font="10p,steelblue", position=code, justify="MC", text="●", no_clip=True) | ||
|
||
fig.show(width=600) | ||
``` | ||
|
||
|
||
Plot embellishments can be abstracted as rectangles. Here, the justification codes are | ||
shown exemplary for a colorbar. | ||
|
||
```{code-cell} | ||
--- | ||
tags: [remove-input] | ||
--- | ||
""" | ||
Script showing justification codes for plot embellishments, e.g., a colorbar. | ||
""" | ||
fig = pygmt.Figure() | ||
fig.basemap(projection="X10c/2c", region=[-size, size, -size, size], frame=0) | ||
|
||
fig.colorbar(cmap="buda", frame=0, position="jMC+w10c/2c+h") | ||
|
||
for code in codes: | ||
fig.text( | ||
font="10p,1,black", | ||
position=code, | ||
justify=code, | ||
text=code, | ||
offset="j0.3c/0.15c+v1p,gray30", | ||
) | ||
fig.plot(x=x1, y=y1, style="c0.2c", fill="steelblue", no_clip=True) | ||
|
||
fig.show(width=600) | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we could link to the reference pages for reference and anchor points which will be added in PR #4052 .