GD::Graph says for "use_axis":

If two y-axes are in use and more than two datasets are specified, set this option to an array reference containing a value of 1 or 2 (for the left and right scales respectively) for each dataset being plotted. That is, to plot three datasets with the second on a different scale than the first and third, set this to [1,2,1].

If, as in zentara's Re: Plotting the data using different axes, your data is

my @data = ( ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], [ 3, 4, 14, '', '', '', 7, 20, 15], [ '', '', '', 5, 3, 1, 3, 4, 1], );
, then use_axis => [1,2] will put the [3,4,14,...] on the left axis, and the [...,5,3,1,3,4,1] on the right axis. Using use_axis => [2,1] would swap them.

If you add another row of y data,

my @data = ( ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], [ 3, 4, 14, '', '', '', 7, 20, 15], [ '', '', '', 5, 3, 1, 3, 4, 1], [ 5, 12, 24, 33, 19, 8, 6, 15, 21], );
, you would have it plot on the right axis by using use_axis => [1,2,2]: this says "put the first group of y data on axis 1, the second group on axis two, and the third group on axis two.".

If you add a fourth row

my @data = ( ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], [ 3, 4, 14, '', '', '', 7, 20, 15], [ '', '', '', 5, 3, 1, 3, 4, 1], [ 5, 12, 24, 33, 19, 8, 6, 15, 21], [ 3, 14, 15, 9, 2, 6, 5, 3, 5], );
, you would have it plot on the left axis by using use_axis => [1,2,2,1], which says "put the first group of y data on axis 1, the second group on axis two, and the third group on axis two, and the fourth group on axis one."

zentara's code may have confused you, with the commented rows, and having four elements in the use_axis array, even though only two groups of y data were uncommented... but if you had just uncommented the extra rows, you could have seen which axis they ended up on, which is why I believe zentara left those commented lines available.

edit: please use <code> tags, like <code>[ 5, 12, 24, 33, 19, 8, 6, 15, 21]</code>, so your anonymous-array examples don't get converted into links by the perlmonks rendering engine


In reply to Re^3: Plotting the data using different axes by pryrt
in thread Plotting the data using different axes by Sarat1729

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.