Skip to content
Draft
Changes from 8 commits
Commits
Show all changes
350 commits
Select commit Hold shift + click to select a range
c9c9d75
Add Docstrings
yvonnefroehlich Mar 16, 2025
efff204
Fix import in Gallery example
yvonnefroehlich Mar 16, 2025
7779832
Update index
yvonnefroehlich Mar 16, 2025
79500dd
Update gallery example
yvonnefroehlich Mar 16, 2025
7f9d57e
Update imports
yvonnefroehlich Mar 16, 2025
2132e5e
Add tests
yvonnefroehlich Mar 16, 2025
438a100
Follow code style
yvonnefroehlich Mar 16, 2025
cb854e3
Update docs
yvonnefroehlich Mar 16, 2025
3d40b6a
Remove exectuion permission
yvonnefroehlich Mar 16, 2025
d81c077
Remove exection permission
yvonnefroehlich Mar 16, 2025
2696234
Remove execution permission
yvonnefroehlich Mar 16, 2025
c9262cc
Update docstrings
yvonnefroehlich Mar 16, 2025
5999c51
Follow rules for variable names and use no space between consonants
yvonnefroehlich Mar 16, 2025
4121569
Reduce galler example
yvonnefroehlich Mar 16, 2025
16eb3dc
Expand tests
yvonnefroehlich Mar 16, 2025
6d71dc3
Set box default to None
yvonnefroehlich Mar 17, 2025
e8c693e
Plot without setting up basemap
yvonnefroehlich Mar 17, 2025
dcc38e1
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 17, 2025
1a2ca98
Add more parameters
yvonnefroehlich Mar 17, 2025
d716bd5
Exclude PLR0913
yvonnefroehlich Mar 17, 2025
59dff81
Update tests
yvonnefroehlich Mar 17, 2025
d35c445
Use default position=Non
yvonnefroehlich Mar 18, 2025
13306c8
Remove blank line
yvonnefroehlich Mar 18, 2025
78ea05a
Move function create_logo out of function pygmtlogo
yvonnefroehlich Mar 18, 2025
7910e05
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 18, 2025
6ec39e7
Adjust defaults
yvonnefroehlich Mar 20, 2025
787530d
Update gallery example
yvonnefroehlich Mar 20, 2025
7601e93
Fix typo
yvonnefroehlich Mar 20, 2025
ec13d17
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 20, 2025
1f1bfd9
Adjust gallery example
yvonnefroehlich Mar 21, 2025
1b51c05
Adjust docstring
yvonnefroehlich Mar 21, 2025
ebcf510
Fix typo
yvonnefroehlich Mar 21, 2025
9dbf096
Update docstrings
yvonnefroehlich Mar 26, 2025
b07fe8c
Include 'orientation' parameter into 'wordmark' parameter
yvonnefroehlich Mar 26, 2025
ea9e9e0
Update gallery example
yvonnefroehlich Mar 26, 2025
33a91b1
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 26, 2025
4bb45af
Do not plot invisible basemap at the beginning
yvonnefroehlich Mar 26, 2025
33517d6
Remove un-needed variable
yvonnefroehlich Mar 26, 2025
f7e5cd6
Fix variable name after renaming for coding style
yvonnefroehlich Mar 26, 2025
11b9a49
Remove un-needed comment
yvonnefroehlich Mar 26, 2025
95aee4f
Remove un-needed code block
yvonnefroehlich Mar 26, 2025
d4c17ae
Fix code style
yvonnefroehlich Mar 26, 2025
3cdd4f3
Update intro text of gallery example
yvonnefroehlich Mar 26, 2025
38e15f7
Update docs
yvonnefroehlich Mar 26, 2025
2f6decb
Use fixed angle for rotation -> remove variable
yvonnefroehlich Mar 27, 2025
eaa6e12
Shorten variable names
yvonnefroehlich Mar 27, 2025
85d09d2
Shorten variable names for compass lines
yvonnefroehlich Mar 27, 2025
a994624
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 27, 2025
8116295
Remove un-needed string f
yvonnefroehlich Mar 27, 2025
a50ebfd
Update parameter names
yvonnefroehlich Mar 27, 2025
f0f7fbd
Update gallery example
yvonnefroehlich Mar 27, 2025
6d360d3
Improve docs
yvonnefroehlich Mar 27, 2025
b74eb73
Fit code in one line
yvonnefroehlich Mar 27, 2025
0cec697
Fit code in one line
yvonnefroehlich Mar 27, 2025
eaed88a
Fix comments
yvonnefroehlich Mar 27, 2025
3b8f3d7
Improve comment
yvonnefroehlich Mar 27, 2025
28e79ae
Fix typo
yvonnefroehlich Mar 27, 2025
b766c1b
Fix length
yvonnefroehlich Mar 27, 2025
62a70b8
Remove un-used 'no_clip' parameter
yvonnefroehlich Mar 28, 2025
d01531f
Remove un-needed 'no_clip' parameter
yvonnefroehlich Mar 28, 2025
5086e11
Adjust variable name
yvonnefroehlich Mar 28, 2025
b969a82
Remove un-needed 'no_clip' parameter
yvonnefroehlich Mar 28, 2025
d4effc4
Add 'no_clip' parameter back for hexagon shape
yvonnefroehlich Mar 29, 2025
9732287
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 29, 2025
c78b2f3
Add 'no_clip' parameter back for hexagon shape
yvonnefroehlich Mar 29, 2025
0867085
TEST Add invisible basemap back to also have a square for hexagon shape
yvonnefroehlich Mar 29, 2025
77636b6
Adjust size of basemap in all combination test plot
yvonnefroehlich Mar 29, 2025
229046c
Fix syntax and use maximum line lenght
yvonnefroehlich Mar 29, 2025
9b7d1e9
Fix highlighting
yvonnefroehlich Mar 29, 2025
54f8880
Fix typo in code
yvonnefroehlich Mar 29, 2025
5c8e12f
Fix line length
yvonnefroehlich Mar 29, 2025
5fd657f
Remove invisble basemap
yvonnefroehlich Mar 29, 2025
1ed44b4
Add code for all versions
yvonnefroehlich Mar 29, 2025
92ccf97
Fix seperator
yvonnefroehlich Mar 29, 2025
3296b11
Add more combinations
yvonnefroehlich Mar 29, 2025
858e532
Reorder versions
yvonnefroehlich Mar 29, 2025
9a0f12e
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 31, 2025
e86f164
Improve region and projection arguments
yvonnefroehlich Apr 8, 2025
ed4a782
Adjust pen for arrow
yvonnefroehlich Apr 9, 2025
7fcbc03
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 9, 2025
e0ede2e
First version of polygon for letter M
yvonnefroehlich Apr 10, 2025
b8d9e8c
Get ride of the xshift for letter M
yvonnefroehlich Apr 10, 2025
17c3503
Fine tune x and y values
yvonnefroehlich Apr 10, 2025
80a1487
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 19, 2025
08b3551
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jun 1, 2025
f396ac0
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jun 10, 2025
e432f79
Improve comment
yvonnefroehlich Jun 11, 2025
fae8282
Use match case for theme
yvonnefroehlich Jun 11, 2025
e015226
Use case match for shpae
yvonnefroehlich Jun 11, 2025
aee2574
Use full line length
yvonnefroehlich Jun 11, 2025
57fe4a9
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jun 11, 2025
0eacfa9
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jul 7, 2025
2a1464a
Save seperation lines
yvonnefroehlich Jul 24, 2025
a2c3da8
Remove seperation lines
yvonnefroehlich Jul 24, 2025
0042ed9
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jul 24, 2025
c46658d
Fix typo
yvonnefroehlich Aug 6, 2025
f7082c4
Use line length
yvonnefroehlich Aug 6, 2025
ba7f14d
Add perspective parameter for letter M
yvonnefroehlich Aug 6, 2025
1e3bea4
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Aug 6, 2025
faa61dd
Define radii
yvonnefroehlich Aug 6, 2025
b75dbad
Improve code for compass
yvonnefroehlich Aug 6, 2025
5e345e5
Draw letter G via x/y coordinates
yvonnefroehlich Aug 6, 2025
3ffbcdf
Add numpy import
yvonnefroehlich Aug 6, 2025
d49633a
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Aug 19, 2025
76dec8b
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Aug 25, 2025
ff77fe8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Aug 27, 2025
86ded86
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Sep 4, 2025
b352346
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Sep 6, 2025
97ce3d7
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Sep 24, 2025
97ee7dc
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Oct 3, 2025
a546342
Use basemap and allow adding frame and gridlines for debugging
yvonnefroehlich Nov 3, 2025
4003b3c
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 3, 2025
ec5be4a
Use variables
yvonnefroehlich Nov 3, 2025
0584284
Add vertical line back
yvonnefroehlich Nov 3, 2025
d66c7b6
Use variable
yvonnefroehlich Nov 4, 2025
0949d19
Use variable (leeter G)
yvonnefroehlich Nov 4, 2025
bb3bf23
Use half of the pen thickness of compass lines for
yvonnefroehlich Nov 4, 2025
ee94768
Calculate the position of letter M (sligthly above letter G)
yvonnefroehlich Nov 4, 2025
9072f0d
Add extra vertical compass line above letters "G" and "M"
yvonnefroehlich Nov 4, 2025
a98d25c
Remove not needed return value
yvonnefroehlich Nov 4, 2025
9de8f2e
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 4, 2025
b9de084
Improve plotting the curved horizontal line and the arrow
yvonnefroehlich Nov 4, 2025
4b8e3b6
Add background color
yvonnefroehlich Nov 4, 2025
29910ac
Follow line length limit
yvonnefroehlich Nov 4, 2025
aa6d936
Add perspective parameter for curved horizontal line of letter T
yvonnefroehlich Nov 4, 2025
7cab1bb
Introduce radius for outer limit of curved horizontal line for letter T
yvonnefroehlich Nov 4, 2025
039bad4
Remove frame and circles for orientation
yvonnefroehlich Nov 4, 2025
3e8ae21
Update parameter names in tests
yvonnefroehlich Nov 4, 2025
12be397
Remove tab by white spaces
yvonnefroehlich Nov 4, 2025
5453d16
Remove unneeded comment
yvonnefroehlich Nov 5, 2025
19c0d18
Adjust length of vertical line of compass
yvonnefroehlich Nov 5, 2025
87ba6cf
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 5, 2025
a272a09
Adjust compass line ending at upper right corner of letter M
yvonnefroehlich Nov 5, 2025
4bd8130
Define pen thickness
yvonnefroehlich Nov 6, 2025
193f725
Fix code of orientation circles
yvonnefroehlich Nov 6, 2025
22ecb94
Improve some comments
yvonnefroehlich Nov 7, 2025
ef619bc
Plot only lower part of vertical compass line
yvonnefroehlich Nov 7, 2025
255f7fe
Use a slightly smaller arrow head for letter T
yvonnefroehlich Nov 7, 2025
94f09d7
Remove 'color' from variable names
yvonnefroehlich Nov 7, 2025
7afd52e
Add just radius for arrow
yvonnefroehlich Nov 7, 2025
354e9a2
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 7, 2025
f994c9a
Out-comment fig.show
yvonnefroehlich Nov 7, 2025
f4269bb
Adjust position of horizontal wordmark
yvonnefroehlich Nov 7, 2025
afe3be6
Adjust position of vertical wordmark
yvonnefroehlich Nov 7, 2025
736e60f
Adjust position of wordmark
yvonnefroehlich Nov 7, 2025
0d8b931
Fit hexagon into circles
yvonnefroehlich Nov 7, 2025
fd93480
Correct horizontal compass line to be on top of Earth out line
yvonnefroehlich Nov 7, 2025
5e8bd7e
Reorder parameters in function definition
yvonnefroehlich Nov 8, 2025
c8be168
Reorder docstrings
yvonnefroehlich Nov 8, 2025
2273713
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 8, 2025
1400ab6
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 8, 2025
fdbca4a
Import typing
yvonnefroehlich Nov 9, 2025
8a79a38
Un-commend fig.show
yvonnefroehlich Nov 10, 2025
1b107dc
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 10, 2025
43f79af
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 10, 2025
26c6dce
Use line length
yvonnefroehlich Nov 15, 2025
98bcad8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 15, 2025
efba97a
Polish
yvonnefroehlich Nov 18, 2025
c430948
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 18, 2025
b7d75e5
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 19, 2025
e0b61c8
Update comment
yvonnefroehlich Nov 19, 2025
64f6c9a
Do not invert wordmark text in gray20, always use gray20
yvonnefroehlich Nov 21, 2025
bb31966
Revert "Do not invert wordmark text in gray20, always use gray20"
yvonnefroehlich Nov 21, 2025
8b1fd34
Reduce examples
yvonnefroehlich Nov 21, 2025
f88f30f
Uncomment fig.show
yvonnefroehlich Nov 21, 2025
b238479
Not help gridlines
yvonnefroehlich Nov 21, 2025
93c8ff5
Adjust background color in example
yvonnefroehlich Nov 21, 2025
b37e24e
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 23, 2025
3d030d8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Nov 29, 2025
1d031be
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jan 5, 2026
1deb35c
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Jan 12, 2026
f70d2db
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Feb 5, 2026
abc89a6
Exclude PLR0915
yvonnefroehlich Feb 5, 2026
27937b5
Add pygmt import
yvonnefroehlich Feb 5, 2026
4ed27a7
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Mar 21, 2026
5953cc6
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 1, 2026
aad7292
Adjust line length
yvonnefroehlich Apr 1, 2026
194b15d
Use new pythonic code for no frame
yvonnefroehlich Apr 1, 2026
f6e9b01
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 7, 2026
9920f90
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 12, 2026
12005a7
Define private functions for letter coordinates
yvonnefroehlich Apr 13, 2026
da985c6
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 13, 2026
a585464
Make private function
yvonnefroehlich Apr 14, 2026
01f7c69
Add comment
yvonnefroehlich Apr 14, 2026
5da7271
Fix
yvonnefroehlich Apr 14, 2026
adfd925
Use easier to understand code for letter G
yvonnefroehlich Apr 14, 2026
625a1ff
Use shorter way to set maximum length
yvonnefroehlich Apr 16, 2026
a44dc64
Use shorter way to set zero as start
yvonnefroehlich Apr 16, 2026
0a006bb
Remove close=True
yvonnefroehlich Apr 16, 2026
7333e59
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 16, 2026
31955c6
Use more compact definition of letter G
yvonnefroehlich Apr 16, 2026
da0a5ef
Make coordinate calculation for curved top line of letter T clearer
yvonnefroehlich Apr 16, 2026
cada956
Add name for private function for letter G
yvonnefroehlich Apr 17, 2026
46f3cbf
Add name for private function for letter T
yvonnefroehlich Apr 17, 2026
3e6c4ba
Add name for private function for letter M
yvonnefroehlich Apr 17, 2026
9257aae
Combine comment lines
yvonnefroehlich Apr 17, 2026
e6c21bd
Make compass line consisten with the defined thicknesses
yvonnefroehlich Apr 17, 2026
e9f6594
Remove comment
yvonnefroehlich Apr 18, 2026
b9a262d
Add private function for compass lines
yvonnefroehlich Apr 18, 2026
f226cac
Fix indent
yvonnefroehlich Apr 18, 2026
28e055b
Define private function for vertical red line
yvonnefroehlich Apr 18, 2026
2f92899
Make variable names consistent
yvonnefroehlich Apr 18, 2026
832d836
Make variable names consistent
yvonnefroehlich Apr 18, 2026
346c655
Add and improve private function names
yvonnefroehlich Apr 18, 2026
a57bb5c
Remove unneeded comments
yvonnefroehlich Apr 18, 2026
23b6386
Move docs to plot function
yvonnefroehlich Apr 18, 2026
e3d6e0c
Fix mixed return onf red line coordinates
yvonnefroehlich Apr 18, 2026
1bb046b
Fix typo
yvonnefroehlich Apr 18, 2026
24c8760
Improve coordinates of letter M
yvonnefroehlich Apr 19, 2026
44ba985
Introduce a third pen thickness for letters
yvonnefroehlich Apr 19, 2026
70f6784
Return dicts by private functions
yvonnefroehlich Apr 19, 2026
adc2d78
Introduce third pen thickness for letters
yvonnefroehlich Apr 19, 2026
e730197
Add blank lines to improved readability of the code
yvonnefroehlich Apr 19, 2026
979050c
Change thick to thicker and middle to thick
yvonnefroehlich Apr 19, 2026
a7f326c
Define fourth pen thickness 'thinner' for letter M to define variable…
yvonnefroehlich Apr 19, 2026
0175f7f
Remove old definition of letter M, improve definition of m_y1
yvonnefroehlich Apr 19, 2026
8f9e32e
Make gaps consistent
yvonnefroehlich Apr 19, 2026
c60018e
Use pen thickness variable
yvonnefroehlich Apr 19, 2026
8001dd2
Use for descripte variable names for pen thicknesses and introduce pe…
yvonnefroehlich Apr 19, 2026
af31fa2
Redefine coordinates for letter M
yvonnefroehlich Apr 19, 2026
61ae0c8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich Apr 19, 2026
9c2c36f
Use variable "thick_gt"
yvonnefroehlich Apr 19, 2026
130d1c3
Simplify condition for mask for letter T
yvonnefroehlich Apr 19, 2026
1a73708
Shorten variable names for coordinates of letter M
yvonnefroehlich Apr 19, 2026
0789876
Make gap for arrow head consistent with the other gaps
yvonnefroehlich Apr 19, 2026
a00e695
Improve comment
yvonnefroehlich Apr 19, 2026
bafc7a0
Define compass lines as vectors
yvonnefroehlich Apr 19, 2026
9b4bd13
Fix typo
yvonnefroehlich Apr 19, 2026
6e7fc83
Fix typo
yvonnefroehlich Apr 19, 2026
f171ab4
Add note regarding radii
yvonnefroehlich Apr 19, 2026
d0c8fda
Fix line length, add more help lines
yvonnefroehlich Apr 19, 2026
1766e9c
Define variable x3 for curved top line of letter T
yvonnefroehlich Apr 19, 2026
7f563e1
Add one more helping line
yvonnefroehlich Apr 19, 2026
fe109d9
Use finer discretization for clean endings of top curved line of lett…
yvonnefroehlich Apr 20, 2026
1e889d2
Calculate compass line thickness from the thickness of the souronding…
yvonnefroehlich Apr 20, 2026
47b2ca3
Remove inner compass lines
yvonnefroehlich Apr 20, 2026
7da6093
Fix typos
yvonnefroehlich Apr 20, 2026
73dc51a
Adjust radii and use fractional representation
yvonnefroehlich Apr 20, 2026
0413225
Adjust thickness of gap
yvonnefroehlich Apr 20, 2026
393a3c4
Plot red vertical line as polygon
yvonnefroehlich Apr 20, 2026
8067fba
Limit all compass lines to abs(r1)
yvonnefroehlich Apr 20, 2026
c78c89c
Remove unneeded variable
yvonnefroehlich Apr 20, 2026
718c7a2
Reorder code, improve comments
yvonnefroehlich Apr 20, 2026
20b5d74
Add comment to explain plotting order
yvonnefroehlich Apr 20, 2026
537e750
Improve plotting order
yvonnefroehlich Apr 20, 2026
0515240
Add debug parameter to add helping lines
yvonnefroehlich Apr 20, 2026
89bd0af
TEST: Adjustments for hexagon shape
yvonnefroehlich Apr 20, 2026
7f8f99b
Remove old code parts
yvonnefroehlich Apr 20, 2026
97d1af1
Use max line length
yvonnefroehlich Apr 20, 2026
8df1bba
Plot vertical help lines in one plot call
yvonnefroehlich Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 256 additions & 0 deletions examples/gallery/embellishments/pygmt_logo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
"""
PyGMT logo
==========
The PyGMT logo coded in Python using PyGMT. The design of the logo is kindly provided
by `@sfrooti <https://github.com/sfrooti>`_. The logo consists of a visual and the
wordmark "PyGMT". There are different versions available:

- ``color_concept``: colors of the visual and workmark.
Select between ``"colors"`` (colors for Python (blue and yellow) and GMT (red)) and
``"bw"`` for black and white.
[Default is ``"color"``].
- ``bg_concept``: color of the background.
Select between ``"light"`` (white) and ``"dark"`` (darkgray / gray20).
[Default is ``"dark"``].
- ``shape``: shape of the visual.
Select between ``"circle"`` and ``"hexagon"``.
[Default is ``"circle"``].
- ``angle_rot``: rotation angle of the visual.
Give an angle in degrees (mesuared contour-clockwise from the vertical).
[Default is ``30``]. Should this be flexible ???
- ``wordmark``: add the wordmark "PyGMT".
``True`` or ``False``.
[Default is ``True``]. ???
- ``orientation``: orientation of the wordmark.
Select between ``"vertical"`` (at the bottom) and ``"horizontal"`` (at the right).
[Default is ``"vertical"``].
"""

# %%
from pathlib import Path

import pygmt

# -----------------------------------------------------------------------------
# Changebale settings (-> adjust for your needs; later input for function)
# -----------------------------------------------------------------------------
color_concept = "color" # "color" | "bw"
bg_concept = "dark" # "light" | "dark"
shape = "circle" # "circle" | "hexagon"
angle_rot = 30 # degrees
wordmark = True # True | False
orientation = "horizontal" # "horizontal" | "vertical"
dpi_png = 720 # resolution of saved PNG image


# -----------------------------------------------------------------------------
# Define colors (-> can be discussed)
# -----------------------------------------------------------------------------
if color_concept == "color":
color_blue = "48/105/152" # Python blue
color_yellow = "255/212/59" # Python yellow
color_red = "238/86/52" # GMT red
elif color_concept == "bw" and bg_concept == "light":
color_blue = color_yellow = color_red = "gray20"
elif color_concept == "bw" and bg_concept == "dark":
color_blue = color_yellow = color_red = "white"

match bg_concept:
case "light":
color_bg = "white"
color_py = color_blue
color_gmt = "gray20"
case "dark":
color_bg = "gray20"
color_py = color_yellow
color_gmt = "white"


# -----------------------------------------------------------------------------
# Not-changebale settings (-> need to extended)
# -----------------------------------------------------------------------------
size = 5
region = [-size, size] * 2

xy_yellow_1 = 2.65
xy_yellow_2 = 1.4

pen_yellow = f"5p,{color_yellow}"
pen_red = f"10p,{color_red}"


# %%

# -----------------------------------------------------------------------------
# Start plotting
# -----------------------------------------------------------------------------

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Creating the visual
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fig = pygmt.Figure()
pygmt.config(MAP_FRAME_PEN="cyan@100")
fig.basemap(region=region, projection=f"X{size * 2}c", frame=[0, "+gcyan@100"])

# .............................................................................
# blue circle / hexagon for Earth
# .............................................................................
match shape:
case "circle":
style = "c7.5c"
case "hexagon":
style = "h8.6c"
fig.plot(x=0, y=0, style=style, pen=f"15p,{color_blue}", fill=color_bg)

# .............................................................................
# yellow lines for compass
# .............................................................................
# horizontal yellow line
fig.plot(x=[-4, 4], y=[0, 0], pen=pen_yellow)
# diagonal yellow lines
# upper left
fig.plot(x=[-xy_yellow_1, -xy_yellow_2], y=[xy_yellow_1, xy_yellow_2], pen=pen_yellow)
# lower right
fig.plot(x=[xy_yellow_2, xy_yellow_1], y=[-xy_yellow_2, -xy_yellow_1], pen=pen_yellow)
# lower left
fig.plot(x=[-xy_yellow_1, -xy_yellow_2], y=[-xy_yellow_1, -xy_yellow_2], pen=pen_yellow)
# upper right
fig.plot(x=[xy_yellow_2, xy_yellow_1], y=[xy_yellow_2, xy_yellow_1], pen=pen_yellow)

# .............................................................................
# letter G
# .............................................................................
# horizontal red line
fig.plot(x=[0.1, 1.65], y=[0, 0], pen=f"12p,{color_red}")
# red ring sector
fig.plot(x=0, y=0, style="w3.3c/90/0+i2.35c", fill=color_red)
# space between yellow lines and ring sector
fig.plot(x=0, y=0, style="w3.7c/0/360+i3.3c", fill=color_bg)
# vertical yellow line
fig.plot(x=[0, 0], y=[-4, 4], pen=f"6p,{color_yellow}")
# cover yellow line in lower part of the ring sector
fig.plot(x=0, y=0, style="w3.3c/260/-80+i2.35c", fill=color_red)

# .............................................................................
# upper vertical red line
# .............................................................................
# space between red line and blue circle / hexagon
fig.plot(x=[0, 0], y=[4.01, 3.0], pen=f"18p,{color_bg}")
# red line
fig.plot(x=[0, 0], y=[4.00, 1.9], pen=f"12p,{color_red}")

# .............................................................................
# letter M
# .............................................................................
# space between letter M and yellow line at the right side
# fig.plot(x=[1.6, 1.6], y=[1.5, 1.8], pen=f"10p,{color_bg}")
fig.plot(x=[1.6, 1.6], y=[1.5, 2.0], pen=f"10p,{color_bg}")
# diagonal lines
fig.plot(x=[0.33, 0.90], y=[1.527, 1.00], pen=pen_red)
fig.plot(x=[0.90, 1.43], y=[1.00, 1.527], pen=pen_red)
# middle pick
fig.plot(x=0.9, y=0.9, style="d0.3c", fill=color_red)
# vertical lines
fig.plot(x=[0.285, 0.285], y=[0.00, 1.65], pen=pen_red)
fig.plot(x=[1.47, 1.47], y=[0.00, 1.65], pen=pen_red)
Comment thread
yvonnefroehlich marked this conversation as resolved.
Outdated

# .............................................................................
# letter T
# .............................................................................
# red curved horizontal line
fig.plot(x=0, y=0, style="w4.6c/240/-60+i3.7c", fill=color_red)
# vertical endings of curved horizontal line
fig.plot(x=[-1.05, -1.05], y=[-1.5, -2.5], pen=f"9p,{color_bg}")
fig.plot(x=[1.05, 1.05], y=[-1.5, -2.5], pen=f"9p,{color_bg}")
# arrow head as inverse triangle with pen for space to blue circle / hexagon
fig.plot(x=0, y=-3.55, style="i1.1c", fill=color_red, pen=f"3p,{color_bg}")
# arrow tail
fig.plot(x=[0, 0], y=[-2, -3.57], pen=f"12p,{color_red}")

# .............................................................................
# Save
# .............................................................................
# fig.show()
fig_name = f"pygmt_logo_{shape}_{color_concept}_{bg_concept}"
fig.savefig(fname=f"{fig_name}.eps", dpi=dpi_png)
print(fig_name)


# %%

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Replot and apply rotation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fig = pygmt.Figure()
pygmt.config(MAP_FRAME_PEN="cyan@100")
fig.basemap(region=region, projection=f"X{size * 2}c", frame=[0, f"+g{color_bg}"])

fig.image(
imagefile=f"{fig_name}.eps",
position=f"jMC+w{size * 2}c",
# Rotation around z (vertical) axis placed in the center
perspective=f"{angle_rot}+w0/0",
)

# .............................................................................
# Save
# .............................................................................
# fig.show()
fig_name_rot = f"{fig_name}_rot{angle_rot}deg"
exts = ["eps"] if wordmark is True else ["png", "pdf", "eps"]
for ext in exts:
# transparent = True if ext == "png" else False # problems with code style
transparent = False
if ext == "png":
transparent = True
fig.savefig(fname=f"{fig_name_rot}.{ext}", dpi=dpi_png, transparent=transparent)
print(fig_name_rot)


# %%

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Replot and add WordMark "PyGMT"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if wordmark is True:
match orientation:
case "vertical":
projection = f"X{size * 2 - 2}c/{size * 2}c"
position = f"jMC+w{size * 2}c+o0c/1.1c"
args_text = {"x": -3.6, "y": -3.6, "justify": "LM"}
args_cover = {"x": -2.4, "y": -3.6}
case "horizontal":
projection = f"X{size * 2}c/{size - 2}c"
position = f"jLM+w{size - 1.5}c"
args_text = {"x": -1.5, "y": 0, "justify": "LM"}
args_cover = {"x": -0.5, "y": -0.2}

fig = pygmt.Figure()
pygmt.config(MAP_FRAME_PEN="cyan@100")
fig.basemap(region=region, projection=projection, frame=[0, f"+g{color_bg}"])

fig.image(imagefile=f"{fig_name_rot}.eps", position=position)

fig.text(text="PyGMT", font=f"50p,AvantGarde-Book,{color_gmt}", **args_text)
fig.plot(style="s2.9c", fill=color_bg, **args_cover)
fig.text(text="Py", font=f"50p,AvantGarde-Book,{color_py}", **args_text)

# .............................................................................
# Save
# .............................................................................
fig_name_rot_text = f"{fig_name_rot}_wordmark_{orientation}"
for ext in ["png", "pdf", "eps"]:
# transparent = True if ext == "png" else False # problems with code style
transparent = False
if ext == "png":
transparent = True
fig.savefig(
fname=f"{fig_name_rot_text}.{ext}", dpi=dpi_png, transparent=transparent
)
print(fig_name_rot_text)
Path.unlink(f"{fig_name_rot}.eps")


# %%
fig.show()
Path.unlink(f"{fig_name}.eps")
Loading