Skip to content

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.

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.

@seisman seisman reopened this Mar 13, 2025
@seisman
Copy link
Member

seisman commented Nov 7, 2025

  1. Updated animation for producing the logo step by step. It looks pretty good:
    animation

  2. The "hexagon"-shape logo is not ideal, especially how the yellow compass lines intersect with the blue hexagon outline. I'm thinking if we should drop the hexagon logo in the initial version and add it later if there is still interest.

logo
  1. What about renaming variables like color_blue to blue, to make the codes shorter?

@yvonnefroehlich
Copy link
Member Author

yvonnefroehlich commented Nov 7, 2025

I made two small updates (i) slightly smaller arrow head for letter T and (ii) shorten the vertical compass line:

old new
pygmt_logo_largearrow_PRAT pygmt_logo_smallarrow_PART
pygmt_logo_longline_PART pygmt_logo_shortline_PART

So far I removed color from the variable names color_blue, color_yellow, and color_red.
I agree, the for the hexagon shape, the compass lines are not optimal.

@yvonnefroehlich
Copy link
Member Author

I adjusted the position of the wordmark:

circle hexagon (for completness included)
pygmt_logo_wm_circle_horizontal pygmt_logo_wm_hexagon_horizontal
pygmt_logo_wm_circle_vertical pygmt_logo_wm_hexagon_vertical

In case we keep or when we later add the hexagon version, we should make the circle and hexagon versions have the same overall size.

@yvonnefroehlich
Copy link
Member Author

yvonnefroehlich commented Nov 7, 2025

Just tried to adjust the codes to make the hexagon version look at bit better.

Figure 2025-11-08 001348 (18) pygmt_logo_circle_wm_hor_NOlines pygmt_logo_circle_wm_vert_NOlines animation_circle_02
Figure 2025-11-08 001634 (18) pygmt_logo_hexagon_wm_hor_NOlines pygmt_logo_hexagon_wm_vert_NOlines animatin_hexagon_02

Now, the compass lines match the hexagon better, but letter T is a bit short.

@seisman
Copy link
Member

seisman commented Nov 8, 2025

@yvonnefroehlich Just in case it’s helpful, I’ve pushed the layered-animation branch, which contains a single commit fd97aea. This commit adds a simple feature: it saves the current figure as frame-xxx.png each time a plotting method is called.

When you run the Figure.pygmtlogo method, you’ll get multiple frame-xxx.png files, which you can then convert into an animation using a command like:

magick -delay 50 -loop 0 frame-*.png animation.gif

symbol = "c" # circle
size_shape = r0 + r1 # radius
size_shape_add = r0 - r1
hex_factor = 1
Copy link
Member

Choose a reason for hiding this comment

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

Instead of defining variables like hex_factor/y_vertline/y_arrow. Can we just define different radii for circle and hexagon shapes?

Copy link
Member Author

@yvonnefroehlich yvonnefroehlich Nov 8, 2025

Choose a reason for hiding this comment

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

Hm, not sure, if this is easy possible. I think the critical point is that for the hexagon shape, the distance to the shape outlines varies, e.g., it is different between the horizontal compass lines and the vertical red line or the arrow for the letter T.

Maybe your are right and we should focus on the circle shape first (and if wanted or requested we can add the hexagon version later).

Copy link
Member

Choose a reason for hiding this comment

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

The logo will appear in Figure 2, but we don't have to finalize it before the manuscript is accepted. So we still have plenty of time to improve it.

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

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants