use warnings; use strict; my $output = "C:/ .../output.ps"; my $multiplot_title = = qq{set multiplot layout 2, 1 title "The Evaluation X" font "Helvetica-Bold,16" set key inside right bottom set xlabel "{/Helvetica=12 Years}" norotate set ylabel "{/Helvetica=12 Results}" rotate by -270 } ; my %args = ( years => q{[2005.5:2011.5]}, yscala => q{[:100]}, sources => [ { source => q{abc}, color => q{#000080}, title => q{"{/Helvetica=10 ABC_Stuff}"}, }, { source => q{def}, color => q{#800080}, title => q{"{/Helvetica=10 DEF_Stuff}"}, }, { source => q{ghi}, color => q{#008000}, title => q{"{/Helvetica=10 GHI_Stuff}"}, }, { source => q{jkl}, color => q{#000000}, title => q{"{/Helvetica=10 JKL_Stuff}"}, }, ], topic => q{this}, abnormality_border => q{mno}, ); my $first = build_command('01', %args); my $second = build_command('02', %args); my $third = build_command('03', %args); my $fourth = build_command('04', %args); my $fifth = build_command('05', %args); my $sixth = build_command('06', %args); sub build_command { my $num = shift; my %args = @_; my $cmd = sprintf( qq{plot %s %s }, $args{years}, $args{yscala} ); for my $source (@{$args{sources}}){ $cmd .= sprintf( qq{"C:/Stuff/%s_%s_%s.csv" title "" with errorbars lt rgb "%s" lw 2, }, $source->{source}, $args{topic}, $num, $source->{color}, ); $cmd .= sprintf( qq{"C:/Stuff/%s_%s_%s.csv" title %s with lines lt rgb "%s" lw 3, }, $source->{source}, $args{topic}, $num, $source->{title}, $source->{color}, ); } $cmd .= sprintf( qq{"C:/Stuff/%s_%s_%s.csv" with steps lt 1 lw 5 title "{/Helvetica=10 Abnormality Border}" \n\n\n}, $args{abnormality_border}, $args{topic}, $num, ); return $cmd; } open my $P, "|-", "C:/.../gnuplot" or die; printflush $P qq[ set terminal postscript color portrait set output "$output" set termoption enhanced set encoding iso_8859_1 ###################################### $multiplot_title set title "The First Indicator" $first set title "The Second Indicator" $second unset multiplot ###################################### $multiplot_title set title "The Third Indicator" $third set title "The Fourth Indicator" $fourth unset multiplot ###################################### $multiplot_title set title "The Fifth Indicator" $fifth set title "The Sixth Indicator" $sixth unset multiplot ###################################### ]; close $P;