-
Notifications
You must be signed in to change notification settings - Fork 229
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
Open
yvonnefroehlich
wants to merge
45
commits into
main
Choose a base branch
from
add-techref-justify
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+118
−0
Open
Changes from all commits
Commits
Show all changes
45 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 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,117 @@ | ||
--- | ||
file_format: mystnb | ||
--- | ||
|
||
# Justification codes | ||
|
||
To adjust the position of plot embellishments, such as scalebars, directional roses, | ||
colorbars, legends, text, and images, users can pass a two-character (order-independent) | ||
code. Choose from | ||
|
||
- Vertical: **T**\(op), **M**\(iddle), **B**\(ottom) | ||
- Horizontal: **L**\(eft), **C**\(entre), **R**\(ight) | ||
|
||
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: | ||
|
||
```{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.
I feel the description could be better and more accurage, but I don't have good suggestions yet.