Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygmt.set_display: Do nothing when the display method is set to 'none' #2450

Merged
merged 1 commit into from
Mar 23, 2023
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
2 changes: 1 addition & 1 deletion pygmt/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def show(self, dpi=300, width=500, method=None, waiting=0.5, **kwargs):
)
)

if method in ["notebook", "none"]:
if method == "notebook":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self that None != "none". Probably should call "none" "disable", but let's not break backwards compatibility.

if IPython is None:
raise GMTError(
(
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/coast.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def coast(self, **kwargs):
... )
>>> # Show the plot
>>> fig.show()
<IPython.core.display.Image object>
Copy link
Member Author

@seisman seisman Mar 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<IPython.core.display.Image object> also need to be removed because Figure.show() returns nothing.

"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
if not args_in_kwargs(args=["C", "G", "S", "I", "N", "E", "Q", "W"], kwargs=kwargs):
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/grd2cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ def grd2cpt(grid, **kwargs):
>>> fig.grdimage(grid=grid)
>>> # show the plot
>>> fig.show()
<IPython.core.display.Image object>
"""
if kwargs.get("W") is not None and kwargs.get("Ww") is not None:
raise GMTInvalidInput("Set only categorical or cyclic to True, not both.")
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/grdcontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def grdcontour(self, grid, **kwargs):
... )
>>> # show the plot
>>> fig.show()
<IPython.core.display.Image object>
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
with Session() as lib:
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def grdimage(self, grid, **kwargs):
>>> fig.grdimage(grid=grid, cmap="geo", projection="W10c", frame="ag")
>>> # show the plot
>>> fig.show()
<IPython.core.display.Image object>
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
with Session() as lib:
Expand Down
3 changes: 1 addition & 2 deletions pygmt/src/inset.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ def inset(self, **kwargs):
...
>>> # Map elements outside the "with" block are plotted in the main figure
>>> fig.logo(position="jBR+o0.2c+w3c")
>>> fig.show() # doctest: +SKIP
<IPython.core.display.Image object>
>>> fig.show()
"""
kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
with Session() as lib:
Expand Down
1 change: 0 additions & 1 deletion pygmt/src/solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def solar(self, terminator="d", terminator_datetime=None, **kwargs):
... )
>>> # show the plot
>>> fig.show()
<IPython.core.display.Image object>
"""

kwargs = self._preprocess(**kwargs) # pylint: disable=protected-access
Expand Down
2 changes: 0 additions & 2 deletions pygmt/src/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,11 @@ def timestamp(
>>> fig = pygmt.Figure()
>>> fig.timestamp()
>>> fig.show()
<IPython.core.display.Image object>

>>> # Plot the GMT timestamp logo with a custom label.
>>> fig = pygmt.Figure()
>>> fig.timestamp(label="Powered by PyGMT")
>>> fig.show()
<IPython.core.display.Image object>
"""
self._preprocess() # pylint: disable=protected-access

Expand Down