-
Notifications
You must be signed in to change notification settings - Fork 224
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
Specify rectangle's width and height via style parameter in multi-parameter symbols example #1325
Conversation
Co-authored-by: Wei Ji <[email protected]>
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.
Just one more suggestion, otherwise looks good to me!
Co-authored-by: Wei Ji <[email protected]>
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.
Looks good to me!
Sorry, I feel the changes may cause more confusion for users. For rectangle (-Sr), there are two different ways to pass the data. Why there is only one way for -Se? |
Do you mean modifying the 5 examples to include the two methods of specifying the shapes? I.e. have ellipse (e), rotated rectangle (j), rectangle (r), rounded rectangle (R) and pie wedge (w) all use two methods? Img ref: https://docs.generic-mapping-tools.org/6.2/plot.html#id2 |
Sounds good~ The new styles are added for all the multi-parameter symbols in c45d5ea. |
Looks good. The docstrings should also be updated. Now the docstrings only talk about how to pass the 2D array |
also done in c45d5ea. |
I feel that the example description is very confusing, especially the meaning of "required parameters". Shall we split the example into two figures (two figures on the same page)? The first figure uses The second figure uses |
Do you mean using subplots? Or something else.
Slightly off topic, but wanted to cross-reference #1132, as using |
I don't want to complicate the example using subplots. I mean two separate figures on one page, similar to our tutorials, although only one figure will be shown as the gallery thumbnail. Here is the example in my mind (more docstrings need to be added):
|
Good. We could just plot them in one figure instead of two. A quick revision based on @seisman's demo. import pygmt
fig = pygmt.Figure()
fig.basemap(region=[0, 6, 0, 7], projection="x3c", frame=True)
# a simple way to plot multiple points using the same symbol style.
# x and y can be scalar or 1D lists.
fig.plot(x=0.5, y=6, style="e45/3/1", color="orange", pen="2p,black")
fig.plot(x=1.5, y=6, style="j120/5/0.5", color="red3", pen="2p,black")
fig.plot(x=3, y=6, style="r4/1.5", color="dodgerblue", pen="2p,black")
fig.plot(x=4.5, y=6, style="R1.25/4/0.5", color="seagreen", pen="2p,black")
fig.plot(x=5.5, y=6, style="w2.5/45/330", color="lightgray", pen="2p,black")
# the 2nd way is more flexible.
# you can pass 2D arrays to `data` parameter to plot symbols with varying symbol parameters.
data = [[0.5, 1, 45, 3, 1], [0.5, 3, 135, 2, 1]]
fig.plot(data=data, style="e", color="orange", pen="2p,black")
data = [[1.5, 1, 120, 5, 0.5], [1.5, 3, 50, 3, 2]]
fig.plot(data=data, style="j", color="red3", pen="2p,black")
data = [[3, 1, 4, 1.5], [3, 3, 3, 1.5]]
fig.plot(data=data, style="r", color="dodgerblue", pen="2p,black")
data = [[4.5, 1, 1.25, 4, 0.5], [4.5, 3, 2.0, 3.0, 0.2]]
fig.plot(data=data, style="R", color="seagreen", pen="2p,black")
data = [[5.5, 1, 2.5, 45, 330], [5.5, 3, 1.5, 30, 150]]
fig.plot(data=data, style="w", color="lightgray", pen="2p,black")
fig.show() |
I kinda prefer @seisman's two figure plot so that the gallery thumbnail looks nice and small. Assuming that only the first figure will show up? |
Only one figure will be shown as thumbnail, but we can control which one to show by setting |
Yes, the first figure will show up. 23e97cb set |
What I expect to see is:
|
Updated in 739de0d, but it looks a little longer like a tutorial. |
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.
Looks good to me.
Great work, everyone! We can leave this open for a few more hours in case there are any comments on the latest iteration, but if not then should merge by ~2300 UTC so it will be included in v0.4.0. |
Co-authored-by: Meghan Jones <[email protected]>
…ameter symbols example (GenericMappingTools#1325) * Update rectangle in the multi-parameter symbols * Apply suggestions from code review Co-authored-by: Wei Ji <[email protected]> * Apply suggestions from code review Co-authored-by: Wei Ji <[email protected]> * Add new syntax for all the multi-parameter symbols * Split the example into two figures * Update comments * Add gallery thumbnail number * Update sytle * Apply suggestions from code review Co-authored-by: Meghan Jones <[email protected]> Co-authored-by: Wei Ji <[email protected]> Co-authored-by: Michael Grund <[email protected]> Co-authored-by: Dongdong Tian <[email protected]> Co-authored-by: Meghan Jones <[email protected]>
Description of proposed changes
GMT 6.2 allows specifying rectangle's width and height via
style
parameter in GenericMappingTools/gmt#4164.This PR adds this new feature in the example of multi-parameter symbols (Originally posted in #392 (comment)).
See GMT Documentation: -S
Fixes #392
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version