in reply to How to declare variables per loop
Dear All,
thank you very much for your help! You guys are great.
I used the solution from wfsp with some modification since $number should be able to be changed. Therefore I took the parts of the solutions of tospo and aartist too. However I gave up the loops with $number because I had to print the title for each plot too. It is readable (imho) in the form of: my $first = build_command('01', %args);.
I put the complete script here including the gnuplot part.
I knew about the module Chart::Gnuplot. Unfortunately I still cannot download modules on my pc at work. Yes I read Yes, even you can use CPAN - none of the solutions works here. The only one were to copy and paste the code but the module has the XS part so it does not work either. I was not able to persuade my manager as proposed in the article. The command structure in the job can be sometimes more tricky as HoH :-)
Thanks again!
VE
thank you very much for your help! You guys are great.
I used the solution from wfsp with some modification since $number should be able to be changed. Therefore I took the parts of the solutions of tospo and aartist too. However I gave up the loops with $number because I had to print the title for each plot too. It is readable (imho) in the form of: my $first = build_command('01', %args);.
I put the complete script here including the gnuplot part.
I knew about the module Chart::Gnuplot. Unfortunately I still cannot download modules on my pc at work. Yes I read Yes, even you can use CPAN - none of the solutions works here. The only one were to copy and paste the code but the module has the XS part so it does not work either. I was not able to persuade my manager as proposed in the article. The command structure in the job can be sometimes more tricky as HoH :-)
Thanks again!
VE
use warnings; use strict; my $output = "C:/ .../output.ps"; my $multiplot_title = = qq{set multiplot layout 2, 1 title "The Evalua +tion 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" l +w 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;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to declare variables per loop
by wfsp (Abbot) on Oct 13, 2011 at 07:53 UTC | |
by vagabonding electron (Curate) on Oct 13, 2011 at 08:55 UTC | |
Re^2: How to declare variables per loop
by aartist (Pilgrim) on Oct 16, 2011 at 13:31 UTC | |
by vagabonding electron (Curate) on Oct 18, 2011 at 10:31 UTC | |
by aartist (Pilgrim) on Oct 19, 2011 at 19:05 UTC | |
by vagabonding electron (Curate) on Oct 20, 2011 at 12:26 UTC |
In Section
Seekers of Perl Wisdom