Skip to content

Figure.savefig: Clarify that 'transparent' also works for the PNG file associated with the KML format - #3579

Merged
seisman merged 1 commit into
mainfrom
savefig/transparency
Nov 6, 2024
Merged

Figure.savefig: Clarify that 'transparent' also works for the PNG file associated with the KML format#3579
seisman merged 1 commit into
mainfrom
savefig/transparency

Conversation

@seisman

Copy link
Copy Markdown
Member

Changes

  1. Clarify that transparent works for .kml format and add a test for it
  2. Refactor the codes to make it more compact and readable.

@seismanseisman added the documentation Improvements or additions to documentation label Nov 5, 2024
@seismanseisman added this to the 0.14.0 milestone Nov 5, 2024
@seisman
seismanforce-pushed the savefig/transparency branch from d0a0cfb to 94f9f14CompareNovember 5, 2024 03:43
Comment threadpygmt/figure.py
msg = f"Transparency unavailable for '{ext}', only for png."
msg = f"Unknown extension '.{ext}'."
raise GMTInvalidInput(msg)
fmt = fmt.upper()

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Changes to something like "png": "G" if transparent is True else "g" at line #210.

Comment threadpygmt/figure.py
raise GMTInvalidInput(msg)
fmt = fmt.upper()

if transparent and ext not in {"kml", "png"}:

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Instead of checking fmt != "g", here we explicitly check if ext not in {"kml", "png"}

@seismanseisman added the needs review This PR has higher priority and needs review. label Nov 5, 2024
@michaelgrundmichaelgrund added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Nov 5, 2024
@seismanseisman removed the final review call This PR requires final review and approval from a second reviewer label Nov 6, 2024
@seisman
seisman merged commit 40edcf7 into mainNov 6, 2024
@seisman
seisman deleted the savefig/transparency branch November 6, 2024 03:39
seisman added a commit that referenced this pull request Nov 6, 2024
seisman added a commit that referenced this pull request Nov 18, 2024
seisman added a commit that referenced this pull request Nov 18, 2024
seisman added a commit that referenced this pull request Nov 19, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@seisman@michaelgrund