Skip to content

Commit

Permalink
Tutorial 01: Mention "pygmt.Figure.savefig" (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonnefroehlich authored Dec 9, 2024
1 parent 9abe29e commit bfd6a21
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions book/tut01_firstfigure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,31 @@
"fig.show()"
]
},
{
"cell_type": "markdown",
"id": "d4ad78f6-22db-4999-98f3-69b70f29b17f",
"metadata": {},
"source": [
"### 1.3 Saving a figure to a file -- [`pygmt.Figure.savefig`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.savefig)\n",
"To save the figure to a file you can use the [`pygmt.Figure.savefig`](https://www.pygmt.org/v0.13.0/api/generated/pygmt.Figure.savefig) method, and pass the desired file name and extension to the `fname` parameter."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "19fcd8e8-6cbe-4209-b619-73cc89acf0de",
"metadata": {},
"outputs": [],
"source": [
"fig.savefig(fname=\"my_first_figure.png\")"
]
},
{
"cell_type": "markdown",
"id": "c9b6acaa-ffea-4c8a-bf2a-91b73070d06c",
"metadata": {},
"source": [
"### 1.3 Stacking approach of GMT / PyGMT\n",
"### 1.4 Stacking approach of GMT / PyGMT\n",
"1. In GMT/PyGMT, plotting is achieved by layering new elements, meaning that each new element is stacked on top of the previous layers. \n",
"Therefore, if you draw a black line in an earlier layer and then add a new layer (such as color filling), these new layers might cover the original black line, making it invisible.\n",
"2. In a **same figure**, once you define region/projection before, you don't need to define again. "
Expand Down Expand Up @@ -503,7 +522,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.12.6"
},
"panel-cell-order": [
"eb4b43cc-dc76-45d1-a370-7266bd943910",
Expand Down

0 comments on commit bfd6a21

Please sign in to comment.