-
Notifications
You must be signed in to change notification settings - Fork 244
POC: Code PyGMT logo in PyGMT #3849
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
Draft
yvonnefroehlich
wants to merge
350
commits into
main
Choose a base branch
from
code-pygmt-logo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 250 commits
Commits
Show all changes
350 commits
Select commit
Hold shift + click to select a range
c9c9d75
Add Docstrings
yvonnefroehlich efff204
Fix import in Gallery example
yvonnefroehlich 7779832
Update index
yvonnefroehlich 79500dd
Update gallery example
yvonnefroehlich 7f9d57e
Update imports
yvonnefroehlich 2132e5e
Add tests
yvonnefroehlich 438a100
Follow code style
yvonnefroehlich cb854e3
Update docs
yvonnefroehlich 3d40b6a
Remove exectuion permission
yvonnefroehlich d81c077
Remove exection permission
yvonnefroehlich 2696234
Remove execution permission
yvonnefroehlich c9262cc
Update docstrings
yvonnefroehlich 5999c51
Follow rules for variable names and use no space between consonants
yvonnefroehlich 4121569
Reduce galler example
yvonnefroehlich 16eb3dc
Expand tests
yvonnefroehlich 6d71dc3
Set box default to None
yvonnefroehlich e8c693e
Plot without setting up basemap
yvonnefroehlich dcc38e1
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 1a2ca98
Add more parameters
yvonnefroehlich d716bd5
Exclude PLR0913
yvonnefroehlich 59dff81
Update tests
yvonnefroehlich d35c445
Use default position=Non
yvonnefroehlich 13306c8
Remove blank line
yvonnefroehlich 78ea05a
Move function create_logo out of function pygmtlogo
yvonnefroehlich 7910e05
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 6ec39e7
Adjust defaults
yvonnefroehlich 787530d
Update gallery example
yvonnefroehlich 7601e93
Fix typo
yvonnefroehlich ec13d17
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 1f1bfd9
Adjust gallery example
yvonnefroehlich 1b51c05
Adjust docstring
yvonnefroehlich ebcf510
Fix typo
yvonnefroehlich 9dbf096
Update docstrings
yvonnefroehlich b07fe8c
Include 'orientation' parameter into 'wordmark' parameter
yvonnefroehlich ea9e9e0
Update gallery example
yvonnefroehlich 33a91b1
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 4bb45af
Do not plot invisible basemap at the beginning
yvonnefroehlich 33517d6
Remove un-needed variable
yvonnefroehlich f7e5cd6
Fix variable name after renaming for coding style
yvonnefroehlich 11b9a49
Remove un-needed comment
yvonnefroehlich 95aee4f
Remove un-needed code block
yvonnefroehlich d4c17ae
Fix code style
yvonnefroehlich 3cdd4f3
Update intro text of gallery example
yvonnefroehlich 38e15f7
Update docs
yvonnefroehlich 2f6decb
Use fixed angle for rotation -> remove variable
yvonnefroehlich eaa6e12
Shorten variable names
yvonnefroehlich 85d09d2
Shorten variable names for compass lines
yvonnefroehlich a994624
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 8116295
Remove un-needed string f
yvonnefroehlich a50ebfd
Update parameter names
yvonnefroehlich f0f7fbd
Update gallery example
yvonnefroehlich 6d360d3
Improve docs
yvonnefroehlich b74eb73
Fit code in one line
yvonnefroehlich 0cec697
Fit code in one line
yvonnefroehlich eaed88a
Fix comments
yvonnefroehlich 3b8f3d7
Improve comment
yvonnefroehlich 28e79ae
Fix typo
yvonnefroehlich b766c1b
Fix length
yvonnefroehlich 62a70b8
Remove un-used 'no_clip' parameter
yvonnefroehlich d01531f
Remove un-needed 'no_clip' parameter
yvonnefroehlich 5086e11
Adjust variable name
yvonnefroehlich b969a82
Remove un-needed 'no_clip' parameter
yvonnefroehlich d4effc4
Add 'no_clip' parameter back for hexagon shape
yvonnefroehlich 9732287
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich c78b2f3
Add 'no_clip' parameter back for hexagon shape
yvonnefroehlich 0867085
TEST Add invisible basemap back to also have a square for hexagon shape
yvonnefroehlich 77636b6
Adjust size of basemap in all combination test plot
yvonnefroehlich 229046c
Fix syntax and use maximum line lenght
yvonnefroehlich 9b7d1e9
Fix highlighting
yvonnefroehlich 54f8880
Fix typo in code
yvonnefroehlich 5c8e12f
Fix line length
yvonnefroehlich 5fd657f
Remove invisble basemap
yvonnefroehlich 1ed44b4
Add code for all versions
yvonnefroehlich 92ccf97
Fix seperator
yvonnefroehlich 3296b11
Add more combinations
yvonnefroehlich 858e532
Reorder versions
yvonnefroehlich 9a0f12e
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich e86f164
Improve region and projection arguments
yvonnefroehlich ed4a782
Adjust pen for arrow
yvonnefroehlich 7fcbc03
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich e0ede2e
First version of polygon for letter M
yvonnefroehlich b8d9e8c
Get ride of the xshift for letter M
yvonnefroehlich 17c3503
Fine tune x and y values
yvonnefroehlich 80a1487
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 08b3551
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich f396ac0
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich e432f79
Improve comment
yvonnefroehlich fae8282
Use match case for theme
yvonnefroehlich e015226
Use case match for shpae
yvonnefroehlich aee2574
Use full line length
yvonnefroehlich 57fe4a9
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 0eacfa9
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 2a1464a
Save seperation lines
yvonnefroehlich a2c3da8
Remove seperation lines
yvonnefroehlich 0042ed9
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich c46658d
Fix typo
yvonnefroehlich f7082c4
Use line length
yvonnefroehlich ba7f14d
Add perspective parameter for letter M
yvonnefroehlich 1e3bea4
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich faa61dd
Define radii
yvonnefroehlich b75dbad
Improve code for compass
yvonnefroehlich 5e345e5
Draw letter G via x/y coordinates
yvonnefroehlich 3ffbcdf
Add numpy import
yvonnefroehlich d49633a
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 76dec8b
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich ff77fe8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 86ded86
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich b352346
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 97ce3d7
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 97ee7dc
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich a546342
Use basemap and allow adding frame and gridlines for debugging
yvonnefroehlich 4003b3c
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich ec5be4a
Use variables
yvonnefroehlich 0584284
Add vertical line back
yvonnefroehlich d66c7b6
Use variable
yvonnefroehlich 0949d19
Use variable (leeter G)
yvonnefroehlich bb3bf23
Use half of the pen thickness of compass lines for
yvonnefroehlich ee94768
Calculate the position of letter M (sligthly above letter G)
yvonnefroehlich 9072f0d
Add extra vertical compass line above letters "G" and "M"
yvonnefroehlich a98d25c
Remove not needed return value
yvonnefroehlich 9de8f2e
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich b9de084
Improve plotting the curved horizontal line and the arrow
yvonnefroehlich 4b8e3b6
Add background color
yvonnefroehlich 29910ac
Follow line length limit
yvonnefroehlich aa6d936
Add perspective parameter for curved horizontal line of letter T
yvonnefroehlich 7cab1bb
Introduce radius for outer limit of curved horizontal line for letter T
yvonnefroehlich 039bad4
Remove frame and circles for orientation
yvonnefroehlich 3e8ae21
Update parameter names in tests
yvonnefroehlich 12be397
Remove tab by white spaces
yvonnefroehlich 5453d16
Remove unneeded comment
yvonnefroehlich 19c0d18
Adjust length of vertical line of compass
yvonnefroehlich 87ba6cf
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich a272a09
Adjust compass line ending at upper right corner of letter M
yvonnefroehlich 4bd8130
Define pen thickness
yvonnefroehlich 193f725
Fix code of orientation circles
yvonnefroehlich 22ecb94
Improve some comments
yvonnefroehlich ef619bc
Plot only lower part of vertical compass line
yvonnefroehlich 255f7fe
Use a slightly smaller arrow head for letter T
yvonnefroehlich 94f09d7
Remove 'color' from variable names
yvonnefroehlich 7afd52e
Add just radius for arrow
yvonnefroehlich 354e9a2
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich f994c9a
Out-comment fig.show
yvonnefroehlich f4269bb
Adjust position of horizontal wordmark
yvonnefroehlich afe3be6
Adjust position of vertical wordmark
yvonnefroehlich 736e60f
Adjust position of wordmark
yvonnefroehlich 0d8b931
Fit hexagon into circles
yvonnefroehlich fd93480
Correct horizontal compass line to be on top of Earth out line
yvonnefroehlich 5e8bd7e
Reorder parameters in function definition
yvonnefroehlich c8be168
Reorder docstrings
yvonnefroehlich 2273713
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 1400ab6
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich fdbca4a
Import typing
yvonnefroehlich 8a79a38
Un-commend fig.show
yvonnefroehlich 1b107dc
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 43f79af
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 26c6dce
Use line length
yvonnefroehlich 98bcad8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich efba97a
Polish
yvonnefroehlich c430948
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich b7d75e5
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich e0b61c8
Update comment
yvonnefroehlich 64f6c9a
Do not invert wordmark text in gray20, always use gray20
yvonnefroehlich bb31966
Revert "Do not invert wordmark text in gray20, always use gray20"
yvonnefroehlich 8b1fd34
Reduce examples
yvonnefroehlich f88f30f
Uncomment fig.show
yvonnefroehlich b238479
Not help gridlines
yvonnefroehlich 93c8ff5
Adjust background color in example
yvonnefroehlich b37e24e
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 3d030d8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 1d031be
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 1deb35c
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich f70d2db
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich abc89a6
Exclude PLR0915
yvonnefroehlich 27937b5
Add pygmt import
yvonnefroehlich 4ed27a7
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 5953cc6
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich aad7292
Adjust line length
yvonnefroehlich 194b15d
Use new pythonic code for no frame
yvonnefroehlich f6e9b01
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 9920f90
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 12005a7
Define private functions for letter coordinates
yvonnefroehlich da985c6
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich a585464
Make private function
yvonnefroehlich 01f7c69
Add comment
yvonnefroehlich 5da7271
Fix
yvonnefroehlich adfd925
Use easier to understand code for letter G
yvonnefroehlich 625a1ff
Use shorter way to set maximum length
yvonnefroehlich a44dc64
Use shorter way to set zero as start
yvonnefroehlich 0a006bb
Remove close=True
yvonnefroehlich 7333e59
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 31955c6
Use more compact definition of letter G
yvonnefroehlich da0a5ef
Make coordinate calculation for curved top line of letter T clearer
yvonnefroehlich cada956
Add name for private function for letter G
yvonnefroehlich 46f3cbf
Add name for private function for letter T
yvonnefroehlich 3e6c4ba
Add name for private function for letter M
yvonnefroehlich 9257aae
Combine comment lines
yvonnefroehlich e6c21bd
Make compass line consisten with the defined thicknesses
yvonnefroehlich e9f6594
Remove comment
yvonnefroehlich b9a262d
Add private function for compass lines
yvonnefroehlich f226cac
Fix indent
yvonnefroehlich 28e055b
Define private function for vertical red line
yvonnefroehlich 2f92899
Make variable names consistent
yvonnefroehlich 832d836
Make variable names consistent
yvonnefroehlich 346c655
Add and improve private function names
yvonnefroehlich a57bb5c
Remove unneeded comments
yvonnefroehlich 23b6386
Move docs to plot function
yvonnefroehlich e3d6e0c
Fix mixed return onf red line coordinates
yvonnefroehlich 1bb046b
Fix typo
yvonnefroehlich 24c8760
Improve coordinates of letter M
yvonnefroehlich 44ba985
Introduce a third pen thickness for letters
yvonnefroehlich 70f6784
Return dicts by private functions
yvonnefroehlich adc2d78
Introduce third pen thickness for letters
yvonnefroehlich e730197
Add blank lines to improved readability of the code
yvonnefroehlich 979050c
Change thick to thicker and middle to thick
yvonnefroehlich a7f326c
Define fourth pen thickness 'thinner' for letter M to define variable…
yvonnefroehlich 0175f7f
Remove old definition of letter M, improve definition of m_y1
yvonnefroehlich 8f9e32e
Make gaps consistent
yvonnefroehlich c60018e
Use pen thickness variable
yvonnefroehlich 8001dd2
Use for descripte variable names for pen thicknesses and introduce pe…
yvonnefroehlich af31fa2
Redefine coordinates for letter M
yvonnefroehlich 61ae0c8
Merge branch 'main' into code-pygmt-logo
yvonnefroehlich 9c2c36f
Use variable "thick_gt"
yvonnefroehlich 130d1c3
Simplify condition for mask for letter T
yvonnefroehlich 1a73708
Shorten variable names for coordinates of letter M
yvonnefroehlich 0789876
Make gap for arrow head consistent with the other gaps
yvonnefroehlich a00e695
Improve comment
yvonnefroehlich bafc7a0
Define compass lines as vectors
yvonnefroehlich 9b4bd13
Fix typo
yvonnefroehlich 6e7fc83
Fix typo
yvonnefroehlich f171ab4
Add note regarding radii
yvonnefroehlich d0c8fda
Fix line length, add more help lines
yvonnefroehlich 1766e9c
Define variable x3 for curved top line of letter T
yvonnefroehlich 7f563e1
Add one more helping line
yvonnefroehlich fe109d9
Use finer discretization for clean endings of top curved line of lett…
yvonnefroehlich 1e889d2
Calculate compass line thickness from the thickness of the souronding…
yvonnefroehlich 47b2ca3
Remove inner compass lines
yvonnefroehlich 7da6093
Fix typos
yvonnefroehlich 73dc51a
Adjust radii and use fractional representation
yvonnefroehlich 0413225
Adjust thickness of gap
yvonnefroehlich 393a3c4
Plot red vertical line as polygon
yvonnefroehlich 8067fba
Limit all compass lines to abs(r1)
yvonnefroehlich c78c89c
Remove unneeded variable
yvonnefroehlich 718c7a2
Reorder code, improve comments
yvonnefroehlich 20b5d74
Add comment to explain plotting order
yvonnefroehlich 537e750
Improve plotting order
yvonnefroehlich 0515240
Add debug parameter to add helping lines
yvonnefroehlich 89bd0af
TEST: Adjustments for hexagon shape
yvonnefroehlich 7f8f99b
Remove old code parts
yvonnefroehlich 97d1af1
Use max line length
yvonnefroehlich 8df1bba
Plot vertical help lines in one plot call
yvonnefroehlich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| """ | ||
| PyGMT logo | ||
| ========== | ||
| Beside the GMT logo, there is a separate PyGMT logo which can be plotted and added | ||
| to a figure using :meth:`pygmt.Figure.pygmtlogo`. The design of the logo itself is | ||
| kindly provided by `@sfrooti <https://github.com/sfrooti>`_ and consists of a visual | ||
| and the wordmark "PyGMT". | ||
| The logo is available in circle and hexagon shape. It can be plotted using colors of | ||
| Python (blue and yellow) and GMT (red) or in black and white as well as in light or | ||
| dark mode. The wordmark can be added at the right side or bottom of the visual. | ||
|
yvonnefroehlich marked this conversation as resolved.
Outdated
|
||
| """ | ||
|
|
||
| # %% | ||
| import pygmt | ||
|
|
||
| # All versions | ||
| # modified from | ||
| # https://github.com/GenericMappingTools/pygmt/pull/3849#issuecomment-2753372170 | ||
| # by @seisman | ||
| fig = pygmt.Figure() | ||
|
|
||
| # Logo without workmark. | ||
| fig.basemap(region=[0, 7, 0, 13], projection="x1c", frame=["a1f1g1", "+ggray50"]) | ||
| for x, y, theme in [(1, 3, "light"), (4, 3, "dark")]: | ||
| for color, shape in [ | ||
| (True, "circle"), | ||
| (True, "hexagon"), | ||
| (False, "circle"), | ||
| (False, "hexagon"), | ||
| ]: | ||
| fig.pygmtlogo( | ||
| color=color, | ||
| theme=theme, | ||
| shape=shape, | ||
| wordmark=False, | ||
| position=f"g{x}/{y}+jTL+w2c", | ||
| ) | ||
| y += 3 # noqa: PLW2901 | ||
|
|
||
| fig.shift_origin(xshift=8) | ||
|
|
||
| # Logo with vertical wordmark. | ||
| fig.basemap(region=[0, 7, 0, 13], projection="x1c", frame=["a1f1g1", "+ggray50"]) | ||
| for x, y, theme in [(1, 3, "light"), (4, 3, "dark")]: | ||
| for color, shape in [ | ||
| (True, "circle"), | ||
| (True, "hexagon"), | ||
| (False, "circle"), | ||
| (False, "hexagon"), | ||
| ]: | ||
| fig.pygmtlogo( | ||
| color=color, | ||
| theme=theme, | ||
| shape=shape, | ||
| wordmark="vertical", | ||
| position=f"g{x}/{y}+jTL+w2c", | ||
| ) | ||
| y += 3 # noqa: PLW2901 | ||
|
|
||
| fig.shift_origin(xshift=8) | ||
|
|
||
| # Logo with horizontal wordmark. | ||
| fig.basemap(region=[0, 20, 0, 13], projection="x1c", frame=["a1f1g1", "+ggray50"]) | ||
| for x, y, theme in [(1, 3, "light"), (11, 3, "dark")]: | ||
| for color, shape in [ | ||
| (True, "circle"), | ||
| (True, "hexagon"), | ||
| (False, "circle"), | ||
| (False, "hexagon"), | ||
| ]: | ||
| fig.pygmtlogo( | ||
| color=color, | ||
| theme=theme, | ||
| shape=shape, | ||
| wordmark="horizontal", | ||
| position=f"g{x}/{y}+jTL+w0/2c", | ||
| ) | ||
| y += 3 # noqa: PLW2901 | ||
|
|
||
| fig.show(width=1000) | ||
|
|
||
|
|
||
| # sphinx_gallery_thumbnail_number = 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -430,6 +430,7 @@ def _repr_html_(self) -> str: | |
| plot, | ||
| plot3d, | ||
| psconvert, | ||
| pygmtlogo, | ||
| rose, | ||
| scalebar, | ||
| set_panel, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.