Skip to content

Conversation

@willschlitzer
Copy link
Collaborator

Figure for the paper demonstrating basic map creation using the coast module.

@willschlitzer willschlitzer self-assigned this Mar 23, 2023
@willschlitzer willschlitzer requested a review from seisman March 23, 2023 14:24
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Comment on lines +28 to +38
"import pygmt\n",
"\n",
"region=[127.5, 128.5, 26, 27]\n",
"projection=\"M10c\"\n",
"\n",
"\n",
"# Use the Figure class to create a figure object, named \"fig\"\n",
"fig = pygmt.Figure()\n",
"fig.coast(\n",
" region=region,\n",
" projection=projection,\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that region and projection are both used only once. Thus, I feel we do not need to define variables, but can pass the arguments directly to the parameters.

Suggested change
"import pygmt\n",
"\n",
"region=[127.5, 128.5, 26, 27]\n",
"projection=\"M10c\"\n",
"\n",
"\n",
"# Use the Figure class to create a figure object, named \"fig\"\n",
"fig = pygmt.Figure()\n",
"fig.coast(\n",
" region=region,\n",
" projection=projection,\n",
"import pygmt\n",
"\n",
"\n",
"# Use the Figure class to create a figure object, named \"fig\"\n",
"fig = pygmt.Figure()\n",
"fig.coast(\n",
" # Set the region of the plot\n",
" # Format is [xmin, xmax, ymin, ymax]\n",
" region=[127.5, 128.5, 26, 27],\n",
" # Set the projection to \"M\" for \"Mercator\"\n",
" # Specify the width as 10 centimeters\n",
" projection=\"M10c\",\n",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the example section is demonstrating the Python-GMT syntax, I think it may be a good idea to show how we can assign data to a Python variable (a list for region and a string for projection) and then pass it to a PyGMT function. It doesn't have to be on this specific example, but I want to highlight why PyGMT offers Python-related advantages over GMT syntax.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see your point! From this perspective, assigning variables makes sense!

Comment on lines +36 to +40
"fig.coast(\n",
" region=region,\n",
" projection=projection,\n",
" # Use default setting for figure's frame\n",
" frame=True,\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I am currently wondering, whether it is better to use here pygmt.Figure.basemap for the region, projection, and frame parameters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, now I get from the title of this PR that this example is explicitly set up to show the pygmt.Figure.coast method. So, just ignore this comment 🙂.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants