-
Notifications
You must be signed in to change notification settings - Fork 218
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
Add gallery example "Cross-section along a transect" #2515
Conversation
/format |
Maybe the issue regarding building the documentation for Windows is not related to creating Using the original code at the end of the script to plot # Plot elevation along the survey line
fig.plot(
data=track_df,
fill="gray", # Fill the polygon in "gray"
# Draw a 1-point thick black solid outline
pen="1p,black,solid",
close="+y-8000", # Force closed polygon
incols=[2, 3], # Select order of input columns (zero-based indexing)
) gives my this error message under Windows:
However, when changing the code to # Plot elevation along the survey line
fig.plot(
x=track_df.p,
y=track_df.elevation,
fill="gray", # Fill the polygon in "gray"
# Draw a 1-point thick black solid outline
pen="1p,black,solid",
close="+y-8000", # Force closed polygon
) the script works. Output of
|
Good to know that you're a Windows developer. Could you please add |
This |
I use Windows on my private Laptop, but Linux is installed on my university computer.
Output of
|
The gallery example Sampling along tracks also uses |
There seem to be some similarity with the issue, which came up in PR #2138, please see comments up on #2138 (comment) / #2138 (comment). When Here is a reduced example: When a import pandas as pd
import pygmt
size = 5
# Set up random test data
test_dict_int = {
'a': [ 2, 2, 2, 2],
'z': [ 8, 6, 7, 3],
'x': [-3, -1, 1, 3],
'y': [ 2, 2, 2, 2],
}
test_df_int = pd.DataFrame(data=test_dict_int)
fig = pygmt.Figure()
fig.basemap(
region=[-size, size, -size, size],
projection="X" + str(size*2),
frame=True,
)
fig.plot(
# data=test_df_int, # integers -> WORKs
data=test_df_int.astype(float), # floats -> FAILs
pen="1p,black",
fill="gray",
close="+y-3",
incols=[2, 3],
# verbose="d",
)
# fig.show()
# fig.savefig(fname="bug_MWE.png") Output of
Error message
|
@yvonnefroehlich Could you please open a separate issue report so that we can explore the issue 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.
Thanks @yvonnefroehlich for working on this great example! Just one last minor comment on the units of the cross-section figure, otherwise ok!
projection="X12c/3c", | ||
# Add annotations ("a") and ticks ("f") as well as labels ("+l") | ||
# at the west or left and south or bottom sides ("WSrt") | ||
frame=["WSrt", "xa2f1+lDistance+u@.", "ya4000+lElevation / m"], |
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.
Put units in brackets. The °
symbol will need to wait for #2584 to work.
frame=["WSrt", "xa2f1+lDistance+u@.", "ya4000+lElevation / m"], | |
frame=["WSrt", "xa2f1+lDistance (°) +u@.", "ya4000+lElevation (m)"], |
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.
For the x-axis, there is already the unit degrees add by +u@.
If +u°
works after PR #2584, I can change this.
Hm, I am not sure about putting units in brackets, including both [ ]
or ( )
. I learned this is wrong, and quantity / unit
or quantity in unit
should be used. However, I see again and again figures which do not follow this rule, including figues in scientific publications. Sometimes already the individual guidelines of the journals do not follow this rule. Actually, we already have some examples, which show units in brackets. What do others think?
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, I'm not sure what convention there is for labelling units, maybe it is journal specific also? We can keep using slash if that is more appropriate. And the degree unit can be omitted since it's on the axis already, it's not often that I see distance units in arc degrees actually.
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.
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, I'm not sure what convention there is for labelling units, maybe it is journal specific also? We can keep using slash if that is more appropriate.
I learned this as an official rule during my studies, but it seems that this is not handled in such a strict way everywhere 😂.
Please see #2637 for this bug report. |
Co-authored-by: Dongdong Tian <[email protected]>
Description of proposed changes
This PR aims to re-write the example 026 at https://docs.gmt-china.org/latest/examples/ex026/ to PyGMT and adds the gallery example "cross-section plots along a transect".
Fixes: #2282
Preview: https://pygmt-dev--2515.org.readthedocs.build/en/2515/gallery/images/cross_section.html
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