Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Apr 2, 2025

The issue was originally reported in GenericMappingTools/pygmt#1860.

Here is the CLI version to reproduce the issue:

gmt begin map -V
echo 1 1 | gmt plot -R0/3/0/3 -Skflash/1c -lFlash
echo 2 1 | gmt plot -SkQR/1c -lQR
echo 2 2 | gmt plot -Sc1c -lCircle
# gmt end show

The script fails with the following error:

plot [ERROR]: Could not find either custom symbol or EPS macro

The content of the hidden legend file is:

# Auto-generated legend information file
# LEGEND_JUSTIFICATION: RT
# LEGEND_SCALING: 1
# LEGEND_FRAME:  1p white 0.2c
S - k 0.393701i - default,black - Flash
S - k 0.393701i - default,black - QR
S - c 0.393701i - default,black - Circle

Apparently, the S - k records are incorrect, and they should be S - kflash and S - kQR instead.

This PR fixes the issue.

The output is:
map

The sizes of the symbols are a little too large in this case, but they are consistent with the sizes specified in the -S option. To have smaller sizes, users should add something like +S0.2c to the -l option.

Closes GenericMappingTools/pygmt#1860

@seisman seisman added the bug Something isn't working label Apr 2, 2025
@seisman seisman added this to the 6.6.0 milestone Apr 2, 2025
@seisman seisman changed the title Fix the auto-legend for custom symbols Fix auto-legend for custom symbols Apr 2, 2025
Copy link
Member

@joa-quim joa-quim left a comment

Choose a reason for hiding this comment

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

Not tested but looks good. And if the result is good ...

@seisman seisman merged commit 30bcc97 into master Apr 2, 2025
10 of 12 checks passed
@seisman seisman deleted the bug/legend-custom branch April 2, 2025 15:29
@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-generated legend doesn't work with "custom" (k) symbols

4 participants