Skip to content

plot: Fix the bug that -M+r modifier doesn't set the pen thickness#9070

Merged
seisman merged 1 commit into
masterfrom
plot/fill_between_+r
Jun 25, 2026
Merged

plot: Fix the bug that -M+r modifier doesn't set the pen thickness#9070
seisman merged 1 commit into
masterfrom
plot/fill_between_+r

Conversation

@seisman

@seisman seisman commented Jun 24, 2026

Copy link
Copy Markdown
Member

The plot's -M documenation says (https://docs.generic-mapping-tools.org/6.6/plot.html#m):

+r - Specify a pen to simply draw a line instead of a filled box in the legend, but replace the color information with that from the fill settings (i.e., only the pen width is used as specified, the color is not used).

Based on the documentation, the +r modifier should control the pen thickness of legend entries, but it doesn't work as expected. In the following script, +r5p set the pen thickness to 5p, but 5p is silently ignored.

#!/usr/bin/env bash
# Demonstrate filling of area between two sinusoidal curves with a section of NaNs
gmt begin GMT_fill_curves
	gmt math -T0/720/5 -N3/0 T -C1 COSD -C2 3 MUL SIND 4 DIV -C1,2 1 T 200 250 INRANGE SUB 0 NAN MUL = both_NaN.txt
	gmt plot -Mc+gblue+r5p+l"Short @~l@~ exceeds long" -Bxa90g90+u@. -Byafg -BWStr -JX15c/3c -R0/720/-1.25/2.5 both_NaN.txt -Gred -l"Long @~l@~ exceeds short"
gmt end show

This PR fixes the bug.

@seisman seisman added this to the 6.7.0 milestone Jun 24, 2026
@seisman seisman added the bug Something isn't working label Jun 24, 2026
@Esteban82

Copy link
Copy Markdown
Member

It works for me.
GMT_fill_curves

@seisman seisman merged commit 0644cf9 into master Jun 25, 2026
10 of 14 checks passed
@seisman seisman deleted the plot/fill_between_+r branch June 25, 2026 06:50
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.

2 participants