-
Notifications
You must be signed in to change notification settings - Fork 1
Create a map using coast module #1
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
Conversation
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
| "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", |
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 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.
| "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", |
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.
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.
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, I see your point! From this perspective, assigning variables makes sense!
| "fig.coast(\n", | ||
| " region=region,\n", | ||
| " projection=projection,\n", | ||
| " # Use default setting for figure's frame\n", | ||
| " frame=True,\n", |
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.
Hm. I am currently wondering, whether it is better to use here pygmt.Figure.basemap for the region, projection, and frame parameters?
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, 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 🙂.
Figure for the paper demonstrating basic map creation using the
coastmodule.