Skip to content
46 changes: 46 additions & 0 deletions pygmt/src/rose.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
from pygmt.params import Axis, Frame

__doctest_skip__ = ["rose"]


@fmt_docstring
@use_alias(
Expand Down Expand Up @@ -209,6 +211,50 @@ def rose(
$perspective
$transparency
$wrap

Examples
--------
Load a dataset on fracture lengths and azimuths into a pandas DataFrame.

>>> import pygmt
>>> from pygmt.params import Axis, Frame
>>>
>>> data = pygmt.datasets.load_sample_data(name="fractures")

Create a sector diagram with a diameter of 7.5 centimeters. Use a sector width
of 5 degrees. Fill the sectors in bisque and outline them in brown.

>>> fig = pygmt.Figure()
>>> fig.rose(
... data=data,
... region=[0, 1, 0, 360],
... diameter="7.5c",
... sector="5",
... norm=True,
... frame=True,
... fill="bisque",
... pen="1p,brown",
... )
>>> fig.show()

Create a rose diagram by appending "+r" to the sector width, here 10 degrees.
Add gridlines in steps of 0.2 and 30 degrees for the (normalized) radial and
azimuthal coordinates, respectively.

>>> fig = pygmt.Figure()
>>> fig.rose(
... length=data.length,
... azimuth=data.azimuth,
... region=[0, 1, 0, 360],
... diameter="7.5c",
... sector="10+r",
... norm=True,
... fill="bisque",
... frame=Frame(xaxis=Axis(grid=0.2), yaxis=Axis(grid=30)),
... pen="1p,brown",
... )
>>> fig.show()

"""
aliasdict = AliasSystem(C=Alias(cmap, name="cmap")).add_common(
B=frame,
Expand Down
Loading