Skip to content

Commit c5989ce

Browse files
authored
Add a tutorial to add frames (#12)
1 parent 1c4d845 commit c5989ce

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

docs/index.rst

+7
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ Basics
9999
:align: center
100100

101101
:doc:`tutorials/basics/coastlines`
102+
103+
- .. image:: _images/18736ae188d169a16383b28a3a7afcb8.png
104+
:target: tutorials/basics/frames.html
105+
:width: 80%
106+
:align: center
107+
108+
:doc:`tutorials/basics/frames`

docs/tutorials/basics/frames.rst

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Frames, ticks, titles, and labels
2+
-----------------------
3+
4+
Setting frame, ticks, title, etc., of the plot is handled by the :gmt-module:`-B <basemap#b>` parameter that most plotting modules contain like :gmt-module:`basemap`.
5+
6+
Plot Frame
7+
~~~~~~~~~~
8+
9+
By default, GMT does not add a frame to your plot. For example, we can plot
10+
the coastlines of the world with a Mercator projection:
11+
12+
13+
.. gmtplot::
14+
15+
gmt begin frames png
16+
gmt coast -R-180/180/-60/60 -JM25c -W
17+
gmt end show
18+
19+
20+
To add the default GMT frame style to the plot, add **f** to the :gmt-module:`-B <basemap#b>`.
21+
22+
23+
.. gmtplot::
24+
25+
gmt begin frames png
26+
gmt coast -R-180/180/-60/60 -JM25c -W
27+
gmt basemap -Bf
28+
gmt end show
29+
30+
31+
Tick labels
32+
~~~~~~~~~~
33+
34+
In GMT the tick labels are called annotations. Add them by passing **a** through the :gmt-module:`-B <basemap#b>` parameter:
35+
36+
.. gmtplot::
37+
38+
gmt begin frames png
39+
gmt coast -R-180/180/-60/60 -JM25c -W
40+
gmt basemap -Baf
41+
gmt end show
42+
43+
44+
45+
Gridlines
46+
~~~~~~~~~~
47+
48+
Add automatic grid lines to the plot by adding **g**:
49+
50+
51+
.. gmtplot::
52+
53+
gmt begin frames png
54+
gmt coast -R-180/180/-60/60 -JM25c -W
55+
gmt basemap -Bafg
56+
gmt end show
57+
58+
59+
Title
60+
~~~~~~~~~~
61+
62+
The figure title can be set by passing **+ttitle**:
63+
64+
.. gmtplot::
65+
66+
gmt begin frames png
67+
gmt coast -R-180/180/-60/60 -JM25c -W
68+
gmt basemap -Bafg
69+
gmt basemap -B+t"Mercator Map"
70+
gmt end show

0 commit comments

Comments
 (0)