pygmt.params.Frame
- class pygmt.params.Frame(axes=None, title=None, axis=None, xaxis=None, yaxis=None, zaxis=None, xaxis2=None, yaxis2=None, zaxis2=None)[source]
Class for setting up the frame and axes of a plot.
Examples
To specify the west and south axes with both tick marks and annotations, draw the east and north axes with tick marks but without annotations:
>>> import pygmt >>> fig = pygmt.Figure() >>> fig.basemap( ... region=[0, 10, 0, 20], projection="X10c/10c", frame=Frame(axes="WSen") ... ) >>> fig.show()
To specify the same attributes for all axes, with intervals of 4 for annotations, 2 for ticks, and 1 for gridlines:
>>> fig = pygmt.Figure() >>> fig.basemap( ... region=[0, 10, 0, 20], ... projection="X10c/10c", ... frame=Frame(axes="WSrt", axis=Axis(annot=4, tick=2, grid=1)), ... ) >>> fig.show()
To specify the attributes for each axis separately:
>>> fig = pygmt.Figure() >>> fig.basemap( ... region=[0, 10, 0, 20], ... projection="X10c/10c", ... frame=Frame( ... axes="WSrt", ... xaxis=Axis(annot=4, tick=2, grid=1, label="X Label"), ... yaxis=Axis(annot=5, tick=2.5, grid=1, label="Y Label"), ... ), ... ) >>> fig.show()
-
axes:
str|None= None Controls which axes are drawn and whether they are annotated, using a combination of the codes below. Axis ommitted from the set will not be drawn.
For a 2-D plot, there are four axes: west, east, south, and north (or left, right, bottom, top if you prefer); For a 3-D plot, there is an extra Z-axis. They can be denoted by the following codes:
W (west), E (east), S (south), N (north), Z: Draw axes with both tick marks and annotations.
w (west), e (east), s (south), n (north), z: Draw axes with tick marks but without annotations.
l (left), r (right), b (bottom), t (top), u (up): Draw axes without tick marks or annotations.
For examples:
"WS": Draw the west and south axes with both tick marks and annotations, but do not draw the east and north axes."WSen": Draw the west and south axes with both tick marks and annotations, draw the east and north axes with tick marks but without annotations."WSrt": Draw the west and south axes with both tick marks and annotations, draw the east and north axes without tick marks or annotations."WSrtZ": Draw the west and south axes with both tick marks and annotations, draw the east and north axes without tick marks or annotations, and draw the z-axis with both tick marks and annotations.
For a 3-D plot, if the z-axis code is specified, a single vertical axis will be drawn at the most suitable corner by default. Append any combination of the corner IDs from 1 to 4 to draw one or more vertical axes at the corresponding corners (e.g.,
"WSrtZ1234"):1: the south-western (lower-left) corner
2: the south-eastern (lower-right) corner
3: the north-eastern (upper-right) corner
4: the north-western (upper-left) corner
-
axis:
Axis|None= None Specify the attributes for axes by an
Axisobject.The attributes for each axis can be specified in two ways: (1) specifying the same attributes for all axes using the
axisparameter; (2) specifying the attributes for each axis separately using thexaxis,yaxis,zaxisparameter for the x-, y, and z-axes, respectively.GMT uses the notion of primary (the default) and secondary axes, while secondary axes are optional and mostly used for time axes annotations. To specify the attributes for the secondary axes, use the
xaxis2,yaxis2, andzaxis2parameters.
-
axes: