-
Notifications
You must be signed in to change notification settings - Fork 229
WIP: DOC: Add Technical Reference page for reference and anchor points #4052
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
Draft
yvonnefroehlich
wants to merge
16
commits into
main
Choose a base branch
from
add-techref-points
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.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1a0717a
Add content for reference and anchor points
yvonnefroehlich 93346ea
Remove execution permission
yvonnefroehlich e0e84e9
Add docs
yvonnefroehlich cbbdf67
Use Unix LF line ending
yvonnefroehlich 45584da
Merge branch 'main' into add-techref-points
yvonnefroehlich f1e6409
Merge branch 'main' into add-techref-points
yvonnefroehlich 484dc0b
Merge branch 'main' into add-techref-points
yvonnefroehlich 73f8744
Merge branch 'main' into add-techref-points
yvonnefroehlich 048c44d
Merge branch 'main' into add-techref-points
yvonnefroehlich 033e7d3
Link to justification code page
yvonnefroehlich 57a0ed5
Add links to ref pages
yvonnefroehlich 3232e8c
Use correct synthax for links
yvonnefroehlich 854cf48
Adjust formulation
yvonnefroehlich b3151ec
Merge branch 'main' into add-techref-points
yvonnefroehlich 9bda825
Merge branch 'main' into add-techref-points
yvonnefroehlich 8807b34
Merge branch 'main' into add-techref-points
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
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
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,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](/techref/justification_codes.md). | ||
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) | ||
``` |
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.
Please see changes in #4025. I think we should provide more details about the positioning of embellishments. The reference point is controlled by the
position
/position_type
parameters, and the anchor point is defined by theanchor
/anchor_offset
parameters.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.
Totally agree @seisman! Will wait and leave this PR as draft until you have finished the work on this.
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 think we should finish this PR first, so that we can reference this documentation in PRs like #4025.
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.
Ah OK, that's also fine with me. Hope I will have time to work on this PR in the next days.