pygmt.Figure.directional_rose
- Figure.directional_rose(position=None, position_type='plotcoords', anchor=None, anchor_offset=None, width=None, label=False, fancy=False, box=False, perspective=False, verbose=False, transparency=None)
Add a directional rose on the map.
The directional rose is plotted at the location defined by the reference point (specified by the position and position_type* parameters) and anchor point (specified by the anchor and anchor_offset parameters). Refer to /techref/reference_anchor_points for details about the positioning.
- Parameters:
position/position_type –
Specify the reference point on the map for the directional rose. The reference point can be specified in five different ways, which is selected by the position_type parameter. The actual reference point is then given by the coordinates or code specified by the position parameter.
The position_type parameter can be one of the following:
"mapcoords": position is given as (longitude, latitude) in map coordinates."boxcoords": position is given as (nx, ny) in normalized coordinates, i.e., fractional coordinates between 0 and 1 in both the x and y directions. For example, (0, 0) is the lower-left corner and (1, 1) is the upper-right corner of the plot bounding box."plotcoords": position is given as (x, y) in plot coordinates, i.e., the distances in inches, centimeters, or points from the lower left plot origin."inside"or"outside": position is one of the nine 2-character justification codes, meaning placing the reference point at specific locations, either inside or outside the plot bounding box.
anchor (
Optional[Literal['TL','TC','TR','ML','MC','MR','BL','BC','BR']], default:None) –Anchor point of the directional rose, specified by one of the 2-character justification codes. The default value depends on the position_type parameter.
position_type="inside": anchor defaults to the same as position.position_type="outside": anchor defaults to the mirror opposite of position.Otherwise, anchor defaults to
"MC"(middle center).
anchor_offset (
Sequence[float|str] |None, default:None) – offset or (offset_x, offset_y). Offset the anchor point by offset_x and offset_y. If a single value offset is given, offset_y = offset_x = offset.width (
float|str|None, default:None) – Width of the rose in plot coordinates (append i (inch), cm (centimeters), or p (points)), or append % for a size in percentage of map width [Default is 10 %].label (
Sequence[str] |bool, default:False) – A sequence of four strings to label the cardinal points W,E,S,N. Use an empty string to skip a specific label. If set toTrue, use the default labels["W", "E", "S", "N"].fancy (
Union[Literal[1,2,3],bool], default:False) –Get a fancy rose. The fanciness level can be set to 1, 2, or 3:
Level 1 draws the two principal E-W, N-S orientations
Level 2 adds the two intermediate NW-SE and NE-SW orientations
Level 3 adds the four minor orientations WNW-ESE, NNW-SSE, NNE-SSW, and ENE-WSW
If set to
True, defaults to level 1.box (
Box|bool, default:False) – Draw a background box behind the directional rose. If set toTrue, a simple rectangular box is drawn using MAP_FRAME_PEN. To customize the box appearance, pass apygmt.params.Boxobject to control style, fill, pen, and other box properties.{perspective}
{verbose}
{transparency}
Examples
>>> import pygmt >>> fig = pygmt.Figure() >>> fig.basemap(region=[0, 80, -30, 30], projection="M10c", frame=True) >>> fig.directional_rose(position=(10, 10), position_type="mapcoords") >>> fig.show()