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

POC: Code PyGMT logo in PyGMT #3849

Draft
wants to merge 132 commits into
base: main
Choose a base branch
from
Draft

POC: Code PyGMT logo in PyGMT #3849

wants to merge 132 commits into from

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Mar 13, 2025

Description of proposed changes

Related to #1404 (comment), create the PyGMT logo in Python with PyGMT.

  • Python script
  • Separat method Figure.pygmtlogo or Figure.logo_pygmt as part of the Figure class or addition to the method Figure.logo (which plots the GMT logo)
  • Gallery example

Preview:

Related to

TODO:

  • Update intro comment of this PR
  • Remove temporary files (eps)
  • Include adding a wordmark and it's orientation to the input at the beginning
  • Update codes to finale version of the visual
  • Introduce variables
  • Improve parameter names, e.g., shape="circle" | "hexagon" or hex=False | True
  • Convert to function (remove show and rdeuce save to tempoary eps files, replot via Figure.image)
  • Remove saving as eps file for rotation (first get ride of transparent margin)
  • Remove saving as eps file for adding wordmark (different basemaps due to horizontal and vertical orientation)
  • Convert to a method of the Figure class or addition to Figure.logo.
  • Add or expand gallery example to use the method
  • Explain the story behind the logo in the gallery example

Issues:

  • Get ride of white or transparent margin
  • Currently the rotation and adding the wordmark are done in new Figure objects using the saved eps files. Maybe this is not easy to handle when converting to a method of the Figure classe.
  • Decide about font for the wordmark (font Space Grotesk by Florian Karsten not available in GMT)
  • No direct export to SVG format possible
  • etc.

Version at commit 39e5ba1:

pygmt_logo_merged_01 pygmt_logo_merged_02 pygmt_logo_merged_03

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Mar 13, 2025
@yvonnefroehlich yvonnefroehlich self-assigned this Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title Add first version of PyGMT code for PyGMT logo POC: DOC: Code PyGMT logo in PyGMT and add as gallery example Mar 13, 2025
@yvonnefroehlich
Copy link
Member Author

/format

@michaelgrund
Copy link
Member

michaelgrund commented Mar 13, 2025

I feel the logo definition should be separated into a standalone method, similar to the method to plot the GMT logo. This would allow to plot the PyGMT logo by calling something like pygmt.Figure.pygmt_logo. The individual formats could be selected by different input parameters like you did or hex = True or darkmode = True.

@yvonnefroehlich yvonnefroehlich marked this pull request as draft March 13, 2025 13:27
@yvonnefroehlich yvonnefroehlich changed the title POC: DOC: Code PyGMT logo in PyGMT and add as gallery example POC: DOC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) Mar 13, 2025
@yvonnefroehlich yvonnefroehlich added the feature Brand new feature label Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title POC: DOC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) POC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) Mar 13, 2025
@yvonnefroehlich yvonnefroehlich changed the title POC: Code PyGMT logo in PyGMT (method Figure.pygmt_logo and gallery example) POC: Code PyGMT logo in PyGMT (method or / and gallery example) Mar 13, 2025
@yvonnefroehlich
Copy link
Member Author

ruff v0.10.0 was released 2 hours ago causing the newly falling code style checks.

# Start of subfunction
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

def create_logo( # noqa: PLR0915
Copy link
Member

Choose a reason for hiding this comment

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

Better to move create_logo outside of the pygmtlogo function.

Co-authored-by: Dongdong Tian <[email protected]>
# -----------------------------------------------------------------------------
# Define wordmark
# -----------------------------------------------------------------------------
font = "AvantGarde-Book"
Copy link
Member Author

Choose a reason for hiding this comment

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

The font Space Grotesk by Florian Karsten is not available in GMT. Currently the font AvantGarde-Book is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature Brand new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants