Conversation
|
/format |
|
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 |
|
ruff v0.10.0 was released 2 hours ago causing the newly falling code style checks. |
@yvonnefroehlich You can follow the steps below:
Then, you should be able to call |
Oh, yes!! I already started making a list of still relevant review comments 😅. |
I wonder if we should merge this PR into a separate branch (not |
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Agree, we should focus on the circular version for now. The hexagon version would be nice to have and hex stickers seem to be quite popular. But the hexagon shape makes things so much more (too) complicated and it is difficult to implement things based on calculation rather than on empircal factors. Furthuremore only the circular version directly has the relation to the Earth.
Joa, we can try this. Should test and baseline image added before? |
I think yes |
|
I removed the script for the gallery example. I think we should add it in a separate PR. And the current version was not really a gallery example, but a summary of all versions of the logo. |
yvonnefroehlich
left a comment
There was a problem hiding this comment.
Maybe we can combine some of the tests into one test to have less baseline images.
I've created the |
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
| def _create_logo( # noqa: PLR0915 | ||
| shape: Literal["circle", "hexagon"] = "circle", | ||
| theme: Literal["light", "dark"] = "light", | ||
| wordmark: Literal["horizontal", "vertical"] | bool = True, |
There was a problem hiding this comment.
I wonder if it makes more sense to have wordmark default to False.
| thick_shape = r0 - r1 # for shape | ||
| thick_gt = r4 - r5 # for letters G and T | ||
| thick_m = r4 / 5 # for letter M | ||
| thick_comp = thick_shape / 3 # for compass lines | ||
| thick_gap = (thick_comp / 4) * 3 |
There was a problem hiding this comment.
If we ignore the factor size/256, currently, the thicknesses are:
thick_shape = r0 - r1 = 74
thick_gt = r4 - r5 = 28
thick_m = r4 / 5 = 21.2
thick_comp = 74/3=24.666666
thick_gap = 18.5
I wonder if we could slightly change the radii so that all the above values are integers.
| fig_name_logo = "pygmt_logo" | ||
| fig.savefig(fname=f"{fig_name_logo}.eps") | ||
|
|
||
| return fig_name_logo |
There was a problem hiding this comment.
It's not ideal to hardcode the eps file name in this function. Instead, the pygmtlogo function should use GMTTempoaryFile and pass a tempoary file name to this function.
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>

Description of proposed changes
Related to #1404 (comment), create the PyGMT logo in Python with PyGMT:
Figure.pygmtlogoorFigure.logo_pygmtas part of theFigureclass oraddition to the method
Figure.logo(which plots the GMT logo)Gallery example-> separate PRRelated to
Preview:
https://pygmt-dev--3849.org.readthedocs.build/en/3849/api/generated/pygmt.Figure.pygmtlogo.html
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code