Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions examples/gallery/seismology/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
Focal mechanisms
================

The :meth:`pygmt.Figure.meca` method can plot focal mechanisms or beachballs.
We can specify the focal mechanism nodal planes or moment tensor components
as a dictionary using the ``spec`` parameter (or they can be specified as a
1-D or 2-D array, or within a file). The size of the beachballs can be set
using the ``scale`` parameter. The compressive and extensive quadrants can
be filled either with a color or a pattern via the ``compressionfill`` and
``extensionfill`` parameters, respectively. Use the ``pen`` parameter to
adjust the outline of the beachballs.
The :meth:`pygmt.Figure.meca` method can plot focal mechanisms or beachballs. We can
specify the focal mechanism nodal planes or moment tensor components as a dictionary
using the ``spec`` parameter (or they can be specified as a 1-D or 2-D array, or within
a file). The size of the beachballs can be set using the ``scale`` parameter. The
compressive and extensive quadrants can be filled either with a color or a pattern via
the ``compression_fill`` and ``extension_fill`` parameters, respectively. Use the
``pen`` parameter to adjust the outline of the beachballs.
"""

# %%
Expand Down Expand Up @@ -41,10 +40,10 @@
depth=12.0,
# Fill compressive quadrants with color "red"
# [Default is "black"]
compressionfill="red",
compression_fill="red",
# Fill extensive quadrants with color "cornsilk"
# [Default is "white"]
extensionfill="cornsilk",
extension_fill="cornsilk",
# Draw a 0.5-point thick dark gray ("gray30") solid outline via
# the pen parameter [Default is "0.25p,black,solid"]
pen="0.5p,gray30,solid",
Expand Down
4 changes: 2 additions & 2 deletions examples/gallery/symbols/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

- :meth:`pygmt.Figure.coast`: Land and water masses via ``land`` and ``water``
- :meth:`pygmt.Figure.histogram`: Histogram bars via ``fill``
- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compressionfill`` and
``extensionfill``
- :meth:`pygmt.Figure.meca`: Focal mechanisms via ``compression_fill`` and
``extension_fill``
- :meth:`pygmt.Figure.plot`: Symbols and polygons via ``fill``
- :meth:`pygmt.Figure.rose`: Histogram sectors via ``fill``
- :meth:`pygmt.Figure.solar`: Day-light terminators via ``fill``
Expand Down
20 changes: 10 additions & 10 deletions examples/tutorials/advanced/focal_mechanisms.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
# Filling the quadrants
# ---------------------
#
# Use the parameters ``compressionfill`` and ``extensionfill`` to fill the quadrants
# Use the parameters ``compression_fill`` and ``extension_fill`` to fill the quadrants
# with different colors or :class:`patterns <pygmt.params.Pattern>`.
fig = pygmt.Figure()
fig.basemap(region=region, projection=projection, frame=frame)
Expand All @@ -110,8 +110,8 @@
longitude=-2,
latitude=0,
depth=0,
compressionfill="darkorange",
extensionfill="cornsilk",
compression_fill="darkorange",
extension_fill="cornsilk",
)

fig.meca(
Expand All @@ -120,8 +120,8 @@
longitude=2,
latitude=0,
depth=0,
compressionfill=Pattern(8),
extensionfill=Pattern(31),
compression_fill=Pattern(8),
extension_fill=Pattern(31),
outline=True,
)

Expand Down Expand Up @@ -168,8 +168,8 @@
# both, ``"1"`` to the first, and ``"2"`` to the second nodal plane(s). Only the
# circumference and the specified nodal plane(s) are plotted, i.e. the quadrants
# remain unfilled (transparent). We can make use of the stacking concept of (Py)GMT,
# and use ``nodal`` in combination with the ``outline``, ``compressionfill`` /
# ``extensionfill`` and ``pen`` parameters.
# and use ``nodal`` in combination with the ``outline``, ``compression_fill`` /
# ``extension_fill`` and ``pen`` parameters.

fig = pygmt.Figure()
fig.basemap(region=region, projection=projection, frame=frame)
Expand All @@ -188,9 +188,9 @@
# (ii) Plot the first nodal plane and the circumference in darkorange
# (iii) Plot the circumference in black on top; use "-" to not fill the quadrants
for kwargs in [
{"compressionfill": "lightorange"},
{"compression_fill": "lightorange"},
{"nodal": "1/1p,darkorange"},
{"compressionfill": "-", "extensionfill": "-", "pen": "1p,gray30"},
{"compression_fill": "-", "extension_fill": "-", "pen": "1p,gray30"},
]:
fig.meca(
spec=aki_single,
Expand Down Expand Up @@ -238,7 +238,7 @@
plot_longitude=1,
plot_latitude=2,
offset="+p1p,darkorange+s0.25c",
compressionfill="lightorange",
compression_fill="lightorange",
)

fig.show()
Expand Down
17 changes: 12 additions & 5 deletions pygmt/src/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pygmt.helpers import (
build_arg_list,
data_kind,
deprecate_parameter,
fmt_docstring,
use_alias,
)
Expand Down Expand Up @@ -115,12 +116,18 @@ def _auto_offset(spec) -> bool:


@fmt_docstring
@deprecate_parameter(
"extensionfill", "extension_fill", "v0.18.0", remove_version="v0.20.0"
)
@deprecate_parameter(
"compressionfill", "compression_fill", "v0.18.0", remove_version="v0.20.0"
)
@use_alias(
A="offset",
C="cmap",
E="extensionfill",
E="extension_fill",
Fr="labelbox",
G="compressionfill",
G="compression_fill",
L="outline",
T="nodal",
W="pen",
Expand Down Expand Up @@ -302,12 +309,12 @@ def meca( # noqa: PLR0913
is drawn. Use **+s**\ *size* to plot a small circle at the initial location and
to set the diameter of this circle [Default is no circle]. Use **+p**\ *pen* to
set the pen attributes for this feature [Default is set via ``pen``]. The fill
of the circle is set via ``compressionfill`` or ``cmap``, i.e., corresponds to
of the circle is set via ``compression_fill`` or ``cmap``, i.e., corresponds to
the fill of the compressive quadrants.
compressionfill : str
compression_fill : str
Set color or pattern for filling compressive quadrants [Default is ``"black"``].
This setting also applies to the fill of the circle defined via ``offset``.
extensionfill : str
extension_fill : str
Set color or pattern for filling extensive quadrants [Default is ``"white"``].
pen : str
Set (default) pen attributes for all lines related to the beachball [Default is
Expand Down
Loading