-
Notifications
You must be signed in to change notification settings - Fork 228
Add gallery example showing different polar projection use cases #955
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 48 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
195ce16
Add gallery example showing different polar projection use cases
michaelgrund 9f28102
formatting
michaelgrund bdc0069
Merge branch 'master' into misc-polar-projs
michaelgrund e6ec82f
Merge branch 'master' into misc-polar-projs
michaelgrund e02cc94
Merge branch 'master' into misc-polar-projs
michaelgrund c39ef2a
adjusted annotations
michaelgrund 1ff394b
updates
michaelgrund f728cc5
updated annotations
michaelgrund 5e48e9f
Merge branch 'master' into misc-polar-projs
michaelgrund 354f5eb
added parts of docstrings, still in progress
michaelgrund c39afb8
Merge branch 'misc-polar-projs' of https://github.com/GenericMappingT…
michaelgrund 21d728c
Merge branch 'master' into misc-polar-projs
michaelgrund a63c2d5
added parts of docstrings, still in progress
michaelgrund 7340153
Merge branch 'master' into misc-polar-projs
michaelgrund 63c2f3e
Merge branch 'master' into misc-polar-projs
michaelgrund dc57750
completed docstrings
michaelgrund 6fd46ca
Merge branch 'master' into misc-polar-projs
michaelgrund 86ad5f7
updated docstrings
michaelgrund 8867a92
updated docstrings
michaelgrund 2d5f009
formatting
michaelgrund 02fcd0b
formatting
michaelgrund 9f2473b
Update examples/projections/nongeo/polar-misc.py
michaelgrund 0f1a157
Update examples/projections/nongeo/polar-misc.py
michaelgrund 7107a0e
Update examples/projections/nongeo/polar-misc.py
michaelgrund 02ea10e
Update examples/projections/nongeo/polar-misc.py
michaelgrund d934cd8
Update examples/projections/nongeo/polar-misc.py
michaelgrund 01fa9ee
Update examples/projections/nongeo/polar-misc.py
michaelgrund a43530a
Update examples/projections/nongeo/polar-misc.py
michaelgrund 9d3b275
Update examples/projections/nongeo/polar-misc.py
michaelgrund 3c749e9
Update examples/projections/nongeo/polar-misc.py
michaelgrund 91e51fc
Update examples/projections/nongeo/polar-misc.py
michaelgrund 73da9ce
Update examples/projections/nongeo/polar-misc.py
michaelgrund 639d798
Update examples/projections/nongeo/polar-misc.py
michaelgrund 02cff7f
Update examples/projections/nongeo/polar-misc.py
michaelgrund 258a9a8
Update examples/projections/nongeo/polar-misc.py
michaelgrund f9412ec
Update examples/projections/nongeo/polar-misc.py
michaelgrund 026fadc
Merge branch 'master' into misc-polar-projs
michaelgrund 6ff04d3
Merge branch 'master' into misc-polar-projs
michaelgrund ce5586d
Update examples/projections/nongeo/polar-misc.py
michaelgrund 992b7b5
Update examples/projections/nongeo/polar-misc.py
michaelgrund 42ee401
Update examples/projections/nongeo/polar-misc.py
michaelgrund 8bec63c
Update examples/projections/nongeo/polar-misc.py
michaelgrund 6fcadca
Update examples/projections/nongeo/polar-misc.py
michaelgrund d7913da
Update examples/projections/nongeo/polar-misc.py
michaelgrund 0c6b967
Update examples/projections/nongeo/polar-misc.py
michaelgrund 62af98d
Update examples/projections/nongeo/polar-misc.py
michaelgrund 8da7d4e
Merge branch 'master' into misc-polar-projs
michaelgrund f18a6fb
updated based on code review
michaelgrund 6ca4e9f
Update examples/projections/nongeo/polar-misc.py
michaelgrund 57cd773
Update examples/projections/nongeo/polar-misc.py
michaelgrund 099b8bf
Merge branch 'master' into misc-polar-projs
michaelgrund 91cb328
removed old polar example by new version
michaelgrund bd020c9
Merge branch 'master' into misc-polar-projs
seisman 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 |
---|---|---|
@@ -0,0 +1,158 @@ | ||
r""" | ||
Miscellaneous ways to use polar projections | ||
=========================================== | ||
|
||
Polar projections allow plotting polar coordinate data (e.g. angle | ||
:math:`\theta` and radius *r*). | ||
|
||
The full syntax for polar projections is: | ||
|
||
**P**\ *width*\ [**+a**]\ [**+f**\ [**e**\|\ **p**\|\ *radius*]] | ||
[**+r**\ *offset*][**+t**\ *origin*][**+z**\ [**p**\|\ *radius*]] | ||
|
||
Limits are set via the ``region`` parameter | ||
([*theta_min*, *theta_max*, *radius_min*, *radius_max*]). When using | ||
**P**\ *width* you have to give the *width* of the figure. The lower-case | ||
version **p** is similar to **P** but expects a *scale* instead of | ||
a width (**p**\ *scale*). | ||
|
||
The following customizing modifiers are available: | ||
|
||
- **+a**: by default, :math:`\theta` refers to the angle that is equivalent to | ||
a counterclockwise rotation with respect to the east direction (standard | ||
definition); **+a** indicates that the input data is rotated clockwise | ||
relative to the north direction (geographical azimuth angle). | ||
|
||
- **+r**\ *offset*: represents the offset of the r axis. This modifier allows | ||
you to put the center of the circle not to r=0. | ||
michaelgrund marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- **+t**\ *origin*: sets the angle corresponding to the east direction which is | ||
equivalent to rotating the entire coordinate axis clockwise; if the **+a** | ||
modifier is used, setting the angle corresponding to the north direction is | ||
equivalent to rotating the entire coordinate axis counterclockwise. | ||
|
||
- **+f**: reverses the radial direction. | ||
|
||
- Append **e** to indicate that the r-axis is an elevation angle, and the | ||
range of the r-axis should be between 0 and 90. | ||
- Appending **p** sets the current earth radius (determined by | ||
:gmt-term:`PROJ_ELLIPSOID`) | ||
to the maximum value of the r axis when the r axis is reversed. | ||
- Append *radius* to set the maximum value of the r axis. | ||
|
||
- **+z**: indicates that the r axis is marked as depth instead of radius (e.g. | ||
*r = radius - z*). | ||
|
||
- Append **p** to set radius to the current earth radius. | ||
- Append *radius* to set the value of the radius. | ||
|
||
""" | ||
|
||
import pygmt | ||
|
||
fig = pygmt.Figure() | ||
|
||
pygmt.config(FONT_TITLE="14p,Helvetica,black", FORMAT_GEO_MAP="+D") | ||
|
||
# ============ | ||
|
||
fig.basemap( | ||
# set map limits to theta_min = 0, theta_max = 360, radius_min = 0, radius_max = 1 | ||
region=[0, 360, 0, 1], | ||
# set map width to 5 cm | ||
projection="P5c", | ||
# set the frame and color | ||
frame=["xa45f", "+gbisque"], | ||
) | ||
|
||
fig.text(position="TC", text="projection='P5c'", offset="0/2.0c", no_clip=True) | ||
fig.text(position="TC", text="region=[0, 360, 0, 1]", offset="0/1.5c", no_clip=True) | ||
|
||
fig.shift_origin(xshift="8c") | ||
|
||
# ============ | ||
fig.basemap( | ||
# set map limits to theta_min = 0, theta_max = 360, radius_min = 0, radius_max = 1 | ||
region=[0, 360, 0, 1], | ||
# set map width to 5 cm and interpret input data as geographic azimuth instead | ||
# of standard angle | ||
projection="P5c+a", | ||
# set the frame and color | ||
frame=["xa45f", "+gbisque"], | ||
) | ||
|
||
fig.text(position="TC", text="projection='P5c+a'", offset="0/2.0c", no_clip=True) | ||
fig.text(position="TC", text="region=[0, 360, 0, 1]", offset="0/1.5c", no_clip=True) | ||
|
||
fig.shift_origin(xshift="8c") | ||
|
||
# ============ | ||
fig.basemap( | ||
# set map limits to theta_min = 0, theta_max = 90, radius_min = 0, radius_max = 1 | ||
region=[0, 90, 0, 1], | ||
# set map width to 5 cm and interpret input data as geographic azimuth instead | ||
# of standard angle | ||
projection="P5c+a", | ||
# set the frame and color | ||
frame=["xa45f", "ya0.2", "WNe+gbisque"], | ||
) | ||
|
||
fig.text(position="TC", text="projection='P5c+a'", offset="0/2.0c", no_clip=True) | ||
fig.text(position="TC", text="region=[0, 90, 0, 1]", offset="0/1.5c", no_clip=True) | ||
|
||
fig.shift_origin(xshift="-16c", yshift="-7c") | ||
|
||
# ============ | ||
fig.basemap( | ||
# set map limits to theta_min = 0, theta_max = 90, radius_min = 0, radius_max = 1 | ||
region=[0, 90, 0, 1], | ||
# set map width to 5 cm and interpret input data as geographic azimuth instead | ||
# of standard angle, rotate coordinate system counterclockwise by 45 degrees | ||
projection="P5c+a+t45", | ||
# set the frame and color | ||
frame=["xa30f", "ya0.2", "WNe+gbisque"], | ||
) | ||
|
||
fig.text(position="TC", text="projection='P5c+a\+t45'", offset="0/2.0c", no_clip=True) | ||
fig.text(position="TC", text="region=[0, 90, 0, 1]", offset="0/1.5c", no_clip=True) | ||
|
||
fig.shift_origin(xshift="8c", yshift="1.3c") | ||
|
||
# ============ | ||
fig.basemap( | ||
# set map limits to theta_min = 0, theta_max = 90, radius_min = 3480, | ||
# radius_max = 6371 (Earth's radius) | ||
region=[0, 90, 3480, 6371], | ||
# set map width to 5 cm and interpret input data as geographic azimuth instead | ||
# of standard angle, rotate coordinate system counterclockwise by 45 degrees | ||
projection="P5c+a+t45", | ||
# set the frame and color | ||
frame=["xa30f", "ya", "WNse+gbisque"], | ||
) | ||
|
||
fig.text(position="TC", text="projection='P5c+a\+t45'", offset="0/2.0c", no_clip=True) | ||
fig.text( | ||
position="TC", text="region=[0, 90, 3480, 6371]", offset="0/1.5c", no_clip=True | ||
) | ||
|
||
fig.shift_origin(xshift="8c") | ||
|
||
# ============ | ||
fig.basemap( | ||
# set map limits to theta_min = 0, theta_max = 90, radius_min = 3480, | ||
# radius_max = 6371 (Earth's radius) | ||
region=[0, 90, 3480, 6371], | ||
# set map width to 5 cm and interpret input data as geographic azimuth instead | ||
# of standard angle, rotate coordinate system counterclockwise by 45 degrees, | ||
# r axis is marked as depth | ||
projection="P5c+a+t45+z", | ||
# set the frame and color | ||
frame=["xa30f", "ya", "WNse+gbisque"], | ||
) | ||
|
||
fig.text(position="TC", text="projection='P5c+a\+t45+z'", offset="0/2.0c", no_clip=True) | ||
fig.text( | ||
position="TC", text="region=[0, 90, 3480, 6371]", offset="0/1.5c", no_clip=True | ||
) | ||
|
||
fig.show() |
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.
Uh oh!
There was an error while loading. Please reload this page.