-
Notifications
You must be signed in to change notification settings - Fork 229
Add logarithmic and power projections #742
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
seisman
merged 21 commits into
GenericMappingTools:master
from
willschlitzer:log-power-proj
Dec 23, 2020
Merged
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1e3a5a6
Change name of cartesian.py to cartesian_linear.py and relab title
willschlitzer f02384b
Add cartesian_logarithmic.py
willschlitzer 57f34b8
Change depiction of optional parameters in docstring
willschlitzer bd9b1e8
Add cartesian_power.py
willschlitzer 2d9a201
Merge branch 'master' into log-power-proj
willschlitzer 212785a
Update docstring format on cartesian_power.py
willschlitzer 852224c
Format doctstring
willschlitzer 38c0a7c
Remove code formatting in doctsring of cartesian_power.py
willschlitzer 157ff48
Format docstring in cartesian_power.py
willschlitzer 3fa6f27
Update cartesian_power.py and cartesian_logarithmic.py to use map wid…
willschlitzer d3a4f38
Merge branch 'master' into log-power-proj
willschlitzer 51c521b
Merge branch 'master' into log-power-proj
willschlitzer 6c3679b
Merge branch 'master' into log-power-proj
willschlitzer bf912e7
Merge branch 'master' into log-power-proj
willschlitzer e72a2cd
Merge branch 'master' into log-power-proj
willschlitzer 55baf7f
Update examples/projections/nongeo/cartesian_power.py
willschlitzer 325f881
Update examples/projections/nongeo/cartesian_logarithmic.py
willschlitzer 9f24bfb
Update examples/projections/nongeo/cartesian_power.py
willschlitzer 1c72c6b
Merge branch 'master' into log-power-proj
willschlitzer 80780ea
[format-command] fixes
actions-bot 384462e
Apply suggestions from code review
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
4 changes: 2 additions & 2 deletions
4
examples/projections/nongeo/cartesian.py → ...es/projections/nongeo/cartesian_linear.py
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,37 @@ | ||
""" | ||
Cartesian logarithmic | ||
===================== | ||
|
||
``xwidth[l]/[height[l]]``: Give the ``width`` of the figure and the optional argument \ | ||
``height``. The axis or axes with a logarithmic transformation requires ``l`` after | ||
its size argument. | ||
""" | ||
import pygmt | ||
import numpy as np | ||
|
||
# Create a list of x values 0-100 | ||
xline = np.arange(0, 101) | ||
# Create a list of y-values that are the square root of the x-values | ||
yline = xline ** 0.5 | ||
# Create a list of x values for every 10 in 0-100 | ||
xpoints = np.arange(0, 101, 10) | ||
# Create a list of y-values that are the square root of the x-values | ||
ypoints = xpoints ** 0.5 | ||
|
||
fig = pygmt.Figure() | ||
fig.plot( | ||
region=[1, 100, 0, 10], | ||
# Set a logarithmic transformation on the x-axis | ||
projection="x4cl/0.4c", | ||
# Set the figures frame, color, and gridlines | ||
frame=["WSne+gbisque", "x2g3", "ya2f1g2"], | ||
x=xline, | ||
y=yline, | ||
# Set the line thickness to *1p*, the color to *blue*, and the style to *dash* | ||
pen="1p,blue,-", | ||
) | ||
# Plot square root values as points on the line | ||
# Style of points is 0.3 cm square, color is *red* with a *black* outline | ||
# Points are set to clip if they go off the figure | ||
seisman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fig.plot(x=xpoints, y=ypoints, style="s0.3c", color="red", no_clip="c", pen="black") | ||
seisman marked this conversation as resolved.
Show resolved
Hide resolved
willschlitzer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fig.show() |
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,34 @@ | ||
""" | ||
Cartesian power | ||
=============== | ||
|
||
**x**\ *width*\ [**p**\ *p-value*]/[*height*\ [**p**\ *p-value*]]: Give the | ||
willschlitzer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*width* of the figure and the optional argument *height*. The axis or axes with a | ||
logarithmic transformation requires **p** and the power transformation for that axis. | ||
""" | ||
import pygmt | ||
import numpy as np | ||
|
||
# Create a list of y values 0-10 | ||
yvalues = np.arange(0, 11) | ||
# Create a list of x-values that are the square of the y-values | ||
xvalues = yvalues ** 2 | ||
|
||
fig = pygmt.Figure() | ||
fig.plot( | ||
region=[0, 100, 0, 10], | ||
# Set the power transformation of the x-axis, with a power of 0.5 | ||
projection="x0.75cp0.5/0.4c", | ||
# Set the figures frame, color, and gridlines | ||
frame=["WSne+givory", "xa1p", "ya2f1"], | ||
# Set the line thickness to *thick* | ||
# Use the default color *black* and the default style *solid* | ||
pen="thick", | ||
x=xvalues, | ||
y=yvalues, | ||
) | ||
# Plot x,y values as points on the line | ||
# Style of points is 0.2 cm circles, color is *green* with a *black* outline | ||
# Points are set to clip if they go off the figure | ||
seisman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
fig.plot(x=xvalues, y=yvalues, style="c0.2c", color="green", no_clip="c", pen="black") | ||
seisman marked this conversation as resolved.
Show resolved
Hide resolved
willschlitzer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.