in reply to Populate 2d Chart Using Chart::Gnuplot from a Loop

G'day eyncydious,

Welcome to the monastery.

Short of manually scripting out:

$chart->plot2d($val1) if $val == 1; $chart->plot2d($val1,$val2) if $val == 2; $chart->plot2d($val1,$val2,$val3) if $val == 3; etc...

To achieve this, I'd write something like:

my @datasets; for my $i (...) { .... push @datasets, Chart::Gnuplot::DataSet->new(...); $chart->plot2d(@datasets); }

-- Ken

Replies are listed 'Best First'.
Re^2: Populate 2d Chart Using Chart::Gnuplot from a Loop
by Anonymous Monk on May 06, 2015 at 23:33 UTC
    Worked like a charm for my exact same problem. Only negative is all the plots are the same color. Short of cycling through hex values based on the for loop counter, any idea how to alternate colors of the different dataset points?
      Did you get how to give different colors for data-sets in same plot? It would be grateful if you have an answer. Thanks
Re^2: Populate 2d Chart Using Chart::Gnuplot from a Loop
by goutham (Initiate) on Jun 15, 2015 at 13:55 UTC
    Do you know how to give different colors for data-sets in same plot? It would be grateful if you have an answer. Thanks. Sorry to ask to two people at a time. Something urgent has to be done. Thanks Goutham

      Not being a user of this module, the short answer is no.

      What have you tried?

      The Dataset Option color would seem like a good place to start your research.

      -- Ken