-
Notifications
You must be signed in to change notification settings - Fork 1
Figure 1: Comparison of GMT and PyGMT syntax #4
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
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3869b16
Figure 1: Comparison of GMT and PyGMT syntax
seisman 084a16b
Change PyGMT to GMT in the GMT CLI script
seisman 0f0674a
Need to handle @ symbol
seisman 4332188
Merge branch 'main' into fig1/pygmt-gmt-comparison
seisman 3f9b2aa
Pass a list to region
seisman f668166
Merge branch 'main' into fig1/pygmt-gmt-comparison
seisman 649c589
Use a small figure size
seisman 266a704
Update
seisman 5e20199
Rename use underscore
seisman ef0dd4e
Remove the replace method and use leading tabs
seisman 8245e3c
Fix the figure name
seisman f635aa5
Use consistent text 'GMT' for both versions
seisman c5610bf
Update 1.PyGMT_GMT_comparison.ipynb
seisman 4f496bf
Update 1.PyGMT_GMT_comparison.ipynb
seisman 601cd2e
Update 1.PyGMT_GMT_comparison.ipynb
seisman 03a74eb
Update 1.PyGMT_GMT_comparison.ipynb
seisman 212a2a6
Update 1.PyGMT_GMT_comparison.ipynb
seisman 8fae53b
Update notebook
seisman 4380e8d
Rename the notebook
seisman 5950186
Fix the @ symbol
seisman 27525cc
Add the image output
seisman e8ae1e3
Update Fig1_PyGMT_GMT_comparison.ipynb
seisman d93932d
Update Fig1_PyGMT_GMT_comparison.ipynb
seisman fffbfcf
Remove figure
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
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,136 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "0dfaa938-057e-4201-a936-a17c7a1009a9", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# The PyGMT version:\n", | ||
| "import pygmt\n", | ||
| "\n", | ||
| "fig = pygmt.Figure()\n", | ||
| "fig.basemap(projection=\"N15c\", region=[0, 360, -90, 90], frame=True)\n", | ||
| "fig.coast(land=\"tan\", water=\"lightblue\")\n", | ||
| "fig.text(position=\"MC\", text=\"GMT\", font=\"80p,Helvetica-Bold,red@75\")\n", | ||
| "fig.show()\n", | ||
| "fig.savefig(\"PyGMT_map.png\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "7d56a075-5a02-4730-8c35-2aef38027739", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "%%bash\n", | ||
| "# The GMT CLI version:\n", | ||
| "gmt begin GMT_map png\n", | ||
| " gmt basemap -JN15c -R0/360/-90/90 -B\n", | ||
| " gmt coast -Gtan -Slightblue\n", | ||
| " echo GMT | gmt text -F+f80p,Helvetica-Bold,red@75+cMC\n", | ||
| "gmt end show" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "b304fb4a-d258-470f-89a7-6b2da0ca9283", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Sequence of strings for the PyGMT code.\n", | ||
| "pygmt_str = \"\"\"\n", | ||
| "import pygmt\n", | ||
| "\n", | ||
| "fig = pygmt.Figure()\n", | ||
| "fig.basemap(projection=\"N15c\", region=[0, 360, -90, 90], frame=True)\n", | ||
| "fig.coast(land=\"tan\", water=\"lightblue\")\n", | ||
| "fig.text(position=\"MC\", text=\"GMT\", font=\"80p,Helvetica-Bold,red@@75\")\n", | ||
| "fig.show()\n", | ||
| "fig.savefig(\"PyGMT_map.png\")\n", | ||
| "\"\"\".splitlines()" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "1c229785-c7dc-49e7-960d-c528aee8995a", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Sequence of strings for the GMT CLI code.\n", | ||
| "# The leading tab characters are intentional to match the indentation.\n", | ||
| "gmt_str = \"\"\"\n", | ||
| "gmt begin GMT_map png\n", | ||
| "\\tgmt basemap -JN15c -R0/360/-90/90 -B\n", | ||
| "\\tgmt coast -Gtan -Slightblue\n", | ||
| "\\techo GMT | gmt text -F+f80p,Helvetica-Bold,red@@75+cMC\n", | ||
| "gmt end show\n", | ||
| "\"\"\".splitlines()" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "fa313831-3369-4dc3-bb92-6ca7b671dd65", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import pygmt\n", | ||
| "\n", | ||
| "fig = pygmt.Figure()\n", | ||
| "pygmt.config(FONT_TITLE=\"10p\", MAP_TITLE_OFFSET=\"4p\")\n", | ||
| "fig.basemap(region=[0, 20, 0, 3], projection=\"X7.5c/2c\", frame=\"lrtb+tGMT CLI\")\n", | ||
| "fig.paragraph(\n", | ||
| " x=0.25,\n", | ||
| " y=0.6,\n", | ||
| " text=gmt_str,\n", | ||
| " parwidth=50,\n", | ||
| " linespacing=0.25,\n", | ||
| " alignment=\"left\",\n", | ||
| " justify=\"BL\",\n", | ||
| " font=\"Courier-Bold,6p\"\n", | ||
| ")\n", | ||
| "\n", | ||
| "fig.shift_origin(xshift=\"w+0.1c\")\n", | ||
| "fig.basemap(region=[0, 20, 0, 3], projection=\"X9.25c/2c\", frame=\"lrtb+tPyGMT\")\n", | ||
| "fig.paragraph(\n", | ||
| " x=0.25,\n", | ||
| " y=0.25,\n", | ||
| " text=pygmt_str,\n", | ||
| " parwidth=50,\n", | ||
| " linespacing=0.25,\n", | ||
| " alignment=\"left\",\n", | ||
| " justify=\"BL\",\n", | ||
| " font=\"Courier-Bold,6p\"\n", | ||
| ")\n", | ||
| "fig.show()\n", | ||
| "fig.savefig(\"Fig1_PyGMT_GMT_comparison.png\")" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "pygmt", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.12.7" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } | ||
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.