diff --git a/TimeSeries.pm b/TimeSeries.pm index 3759090..68087b0 100644 --- a/TimeSeries.pm +++ b/TimeSeries.pm @@ -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'";