Skip to content

(Incomplete) inline code examples of pygmt.Figure class #2084

Closed

Description

@yvonnefroehlich

Maybe the inline code examples for the pygmt.Figure class are incomplete:

fig = Figure()
fig.basemap(region=[0, 360, -90, 90], projection="W7i", frame=True)
fig.savefig("my-figure.png")
# Make sure the figure file is generated and clean it up
import os
os.path.exists("my-figure.png")
os.remove("my-figure.png")
fig = Figure()
fig.basemap(region="JP", projection="M3i", frame=True)
# The fig.region attribute shows the WESN bounding box for the figure
print(", ".join(f"{i:.2f}" for i in fig.region))

From my understanding, these examples should be directly executable. In case this is correct, I feel these two examples can be improved:

from pygmt import Figure
fig = Figure()

# OR

import pygmt
fig = pygmt.Figure()

Activity

  1. seisman commented on Aug 27, 2022

    @seisman
    Member

    I think you're right. These codes work well as doctests because Figure is already imported in the Python codes, but they're incomplete as inline code examples.

  2. added
    documentation
    on Aug 27, 2022
  3. added this to the 0.8.0 milestone on Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions