Skip to content
Open
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
36 changes: 35 additions & 1 deletion pygmt/params/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ class _Axes(BaseParam):
title: str | None = None
subtitle: str | None = None
fill: str | None = None
box: bool = False
wall_pen: str | bool = False
yzfill: str | None = None
xzfill: str | None = None
xyfill: str | None = None

@property
def _aliases(self):
Expand All @@ -113,6 +118,11 @@ def _aliases(self):
Alias(self.fill, name="fill", prefix="+g"),
Alias(self.title, name="title", prefix="+t"),
Alias(self.subtitle, name="subtitle", prefix="+s"),
Alias(self.box, name="box", prefix="+b"),
Alias(self.wall_pen, name="wall_pen", prefix="+w"),
Alias(self.yzfill, name="yzfill", prefix="+x"),
Alias(self.xzfill, name="xzfill", prefix="+y"),
Alias(self.xyfill, name="xyfill", prefix="+z"),
]


Expand Down Expand Up @@ -209,6 +219,22 @@ class Frame(BaseParam):
#: fill].
fill: str | None = None

#: Draw the foreground lines of a 3-D box. [For 3-D plots only]
box: bool = False

#: Draw the outlines of the x-z and y-z planes by the specified pen attributes.
#: If ``True``, use the default pen. [For 3-D plots only]
wall_pen: str | bool = False

#: Fill for the yz-plane (the plane normal to the x-axis). [For 3-D plots only]
yzfill: str | None = None

#: Fill for the xz-plane (the plane normal to the y-axis). [For 3-D plots only]
xzfill: str | None = None

#: Fill for the xy-plane (the plane normal to the z-axis). [For 3-D plots only]
xyfill: str | None = None

#: Specify the attributes for axes by an :class:`Axis` object.
#:
#: The attributes for x and y axes can be specified in two ways: (1) specifying the
Expand Down Expand Up @@ -260,7 +286,15 @@ def _aliases(self):
# _Axes() maps to an empty string, which becomes '-B' without arguments and is
# invalid when combined with individual axis settings (e.g., '-B -Bxaf -Byaf').
frame_settings = _Axes(
axes=self.axes, title=self.title, subtitle=self.subtitle, fill=self.fill
axes=self.axes,
title=self.title,
subtitle=self.subtitle,
fill=self.fill,
box=self.box,
wall_pen=self.wall_pen,
yzfill=self.yzfill,
xzfill=self.xzfill,
xyfill=self.xyfill,
)
has_secondary_xy_axis = any([self.axis2, self.xaxis2, self.yaxis2])
return [
Expand Down
18 changes: 18 additions & 0 deletions pygmt/tests/test_params_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ def test_params_frame_only():
frame = Frame(axes="WSEN", title="My Title", subtitle="My Subtitle", fill="red")
assert str(frame) == "WSEN+gred+tMy Title+sMy Subtitle"

frame = Frame(axes="WSrtZ", box=True, wall_pen="1p,red")
assert str(frame) == "WSrtZ+b+w1p,red"

frame = Frame(axes="WSrtZ", yzfill="red", xzfill="green", xyfill="blue")
assert str(frame) == "WSrtZ+xred+ygreen+zblue"

frame = Frame(
axes="WSrtZ",
box=True,
title="My Title",
fill="gray",
wall_pen="0.5p,black",
yzfill="red",
xzfill="green",
xyfill="blue",
)
assert str(frame) == "WSrtZ+ggray+tMy Title+b+w0.5p,black+xred+ygreen+zblue"


def test_params_frame_axis():
"""
Expand Down
Loading