|
13 | 13 | class Axis(BaseParam): |
14 | 14 | """ |
15 | 15 | Class for setting up one axis of a plot. |
| 16 | +
|
| 17 | + Examples |
| 18 | + -------- |
| 19 | + To specify the same attributes for all axes, with intervals of 4 for annotations, |
| 20 | + 2 for ticks, and 1 for gridlines: |
| 21 | +
|
| 22 | + >>> import pygmt |
| 23 | + >>> fig = pygmmt.Figure() |
| 24 | + >>> fig.basemap( |
| 25 | + ... region=[0, 10, 0, 20], |
| 26 | + ... projection="X10c/10c", |
| 27 | + ... frame=Axis(annot=4, tick=2, grid=1), |
| 28 | + ... ) |
| 29 | + >>> fig.show() |
16 | 30 | """ |
17 | 31 |
|
18 | 32 | #: Specify the interval for annoations. It can be ``True`` to let GMT decide the |
@@ -72,6 +86,43 @@ def _aliases(self): |
72 | 86 | class Frame(BaseParam): |
73 | 87 | """ |
74 | 88 | Class for setting up the frame and axes of a plot. |
| 89 | +
|
| 90 | + Examples |
| 91 | + -------- |
| 92 | + To specify the west and south axes with both tick marks and annotations, draw the |
| 93 | + east and north axes with tick marks but without annotations: |
| 94 | +
|
| 95 | + >>> import pygmt |
| 96 | + >>> fig = pygmt.Figure() |
| 97 | + >>> fig.basemap( |
| 98 | + ... region=[0, 10, 0, 20], projection="X10c/10c", frame=Frame(axes="WSen") |
| 99 | + ... ) |
| 100 | + >>> fig.show() |
| 101 | +
|
| 102 | + To specify the same attributes for all axes, with intervals of 4 for annotations, |
| 103 | + 2 for ticks, and 1 for gridlines: |
| 104 | +
|
| 105 | + >>> fig = pygmt.Figure() |
| 106 | + >>> fig.basemap( |
| 107 | + ... region=[0, 10, 0, 20], |
| 108 | + ... projection="X10c/10c", |
| 109 | + ... frame=Frame(axes="WSrt", axis=Axis(annot=4, tick=2, grid=1)), |
| 110 | + ... ) |
| 111 | + ... fig.show() |
| 112 | +
|
| 113 | + To specify the attributes for each axis separately: |
| 114 | +
|
| 115 | + >>> fig = pygmt.Figure() |
| 116 | + >>> fig.basemap( |
| 117 | + ... region=[0, 10, 0, 20], |
| 118 | + ... projection="X10c/10c", |
| 119 | + ... frame=Frame( |
| 120 | + ... axes="WSrt", |
| 121 | + ... xaxis=Axis(annot=4, tick=2, grid=1, label="X-axis"), |
| 122 | + ... yaxis=Axis(annot=5, tick=2.5, grid=1, label="Y-axis"), |
| 123 | + ... ), |
| 124 | + ... ) |
| 125 | + ... fig.show() |
75 | 126 | """ |
76 | 127 |
|
77 | 128 | #: Controls which axes are drawn and whether they are annotated, using a combination |
|
0 commit comments