Escape underscores in legend strings
Other characters have special meaning, too. But they haven't cropped up yet. Anyway, don't run this on untrusted input.
This commit is contained in:
parent
77e8042783
commit
cdd9f6fdd8
|
@ -424,10 +424,11 @@ sub plot {
|
|||
$comma = 1;
|
||||
}
|
||||
my $legend = $self->{legend}[$i];
|
||||
my $escaped_legend = $legend =~ s/_/\\_/gr;
|
||||
if ($self->{style} eq 'filledcurves') {
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, "):(0) title '$legend'";
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, "):(0) title '$escaped_legend'";
|
||||
} else {
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, ") title '$legend'";
|
||||
print $ctlfh "'$datafn' using 1:(\$", $col++, ") title '$escaped_legend'";
|
||||
}
|
||||
if (my $color = $self->{colors}[$i]) {
|
||||
print $ctlfh " linecolor rgbcolor '$color'";
|
||||
|
|
Loading…
Reference in New Issue