Sarat1729 has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Usage of use_axis
by pryrt (Abbot) on Jun 06, 2018 at 12:59 UTC | |
What did you not understand from Re^3: Plotting the data using different axes and the other responses in that other thread you started, where the answer to this question was covered in detail, with coding examples? Update 1: Re-reading your follow on Re^2: Usage of use_axis, I see that you say "Even though, I mention 2 in use_axis to force one of the datasets to refer to the right Y axis, it is not working when the datasets are more than 3." I will work on an example with multiple (>3) datasets, with two significantly different output ranges, so it's obvious which scale each is graphed on, and will post it as another edit in a few minutes. Update 2: sorry for the delay. This version of the code
Running that code, do you see how '123454321' and '0.5x' take up the bulk of the vertical height in "out1.png" and are down near the x-axis in "out2.png". That because they've properly switched from axis2 in "out1" to axis1 in "out2". Update 3: further, if you were to change to $opts{use_axis} = [1,2,2,2,2,2];, which puts some of the "big" datasets on the "small" y axis, you will get an error ("Maximum for y3 too small at ..."), which shows that the third data set '11*(10-x)' tried to go on the small axis, where it doesn't fit. | [reply] [d/l] [select] |
by pryrt (Abbot) on Jun 06, 2018 at 14:04 UTC | |
... Further: if your difficulty is that you were expecting the GD::Graph::multi to automatically disambiguate the two axis: that's not going to happen. But you can do it yourself. For example, in the modified version of the code below, I use the elements of the $opts{use_axis} array to set the value of $opts{types} to 'lines' (for the left axis) or 'points' (for the right axis).
| [reply] [d/l] [select] |
|
Re: Usage of use_axis
by hippo (Archbishop) on Jun 06, 2018 at 07:37 UTC | |
You mean like the example in the distribution? | [reply] |
by Sarat1729 (Sexton) on Jun 06, 2018 at 10:50 UTC | |
| [reply] |
by zentara (Cardinal) on Jun 06, 2018 at 11:23 UTC | |
You can do anything with Perl. If you are willing to manually make your axis and plots, you can do it on a Tk::Canvas, or use something direct like Cairo I'm not really a human, but I play one on earth. ..... an animated JAPH | [reply] |