[Scilab-users] Plots on second Y axis

Stefan Du Rietz sdr at durietz.se
Sat Feb 23 23:46:01 CET 2013


Hi Samuel.
you can have different y_tick.labels on the left and right y axes and 
multiply the y-data of the line with the right y axis with a factor. In 
your case the left y axis could have y_tick.labels from -1 to +1 and the 
right y axis from -2 to +2. But because both lines are drawn in the same 
axes (with the same y_tick.locations from -1 to +1), you have to 
multiply 2*sin(x) by 0.5 to make it correspond to the right y axis 
labels that are multiplied by 2 (1/0.5).

However, in your case both lines will look be the same. But if you 
change the second to 2*cos(x) and give it another color or line style 
(which is somewhere noted to correspond to the right y axis) it could 
work.

/Stefan

On 2013-02-23 23:02, Samuel Enibe wrote:
> Thanks, Stephan.
> Can you help me a little further.
> Suppose I have the data
> x = [0:0.1:1]
> y = sin(x)
> plot(x, y)
> xtitle("My Title", "Value of x", "Sin (x)")
>
> y2 = 2 * sin(x)
> //y2label = "2 * sin(x)"
>
> How do I plot y2 so that it uses the right Y-axis with its y2label
> properly specified
>
> On Sat, Feb 23, 2013 at 1:25 PM, Stefan Du Rietz <sdr at durietz.se
> <mailto:sdr at durietz.se>> wrote:
>
>     http://help.scilab.org/docs/5.__4.0/en_US/drawaxis.html
>     <http://help.scilab.org/docs/5.4.0/en_US/drawaxis.html>
>
>     /Stefan
>
>
>     On 2013-02-23 22:19, Samuel Enibe wrote:
>
>         Thanks, Spougeon.
>         This has partly solved the problem. Suppose I have two plots on
>         the same
>         graph, one is to use the left Y-axis, while the second is to use the
>         right Y-axis. How should I handle it with gca() or any other
>         command?
>
>         Samuel Ogbonna Enibe
>         University of Nigeria, Nsukka, Nigeria
>
>
>         On Fri, Feb 8, 2013 at 8:14 AM, <sgougeon at free.fr
>         <mailto:sgougeon at free.fr>
>         <mailto:sgougeon at free.fr <mailto:sgougeon at free.fr>>> wrote:
>
>              Hello,
>
>              according to your needs, you may do either:
>
>              plot2d()
>              ax = gca();
>              ax.y_location = 'right';
>
>              or
>
>              demo_gui() // then Graphics => 2D & 3D => plotyy | plotyyy
>              // and look at the code, using
>              help newaxes //
>         http://help.scilab.org/docs/5.__4.0/en_US/newaxes.html
>         <http://help.scilab.org/docs/5.4.0/en_US/newaxes.html>
>
>              Regards
>              Samuel
>              _________________________________________________
>              users mailing list
>         users at lists.scilab.org <mailto:users at lists.scilab.org>
>         <mailto:users at lists.scilab.org <mailto:users at lists.scilab.org>__>
>         http://lists.scilab.org/__mailman/listinfo/users
>         <http://lists.scilab.org/mailman/listinfo/users>
>
>
>
>
>         --
>
>
>
>
>         _________________________________________________
>         users mailing list
>         users at lists.scilab.org <mailto:users at lists.scilab.org>
>         http://lists.scilab.org/__mailman/listinfo/users
>         <http://lists.scilab.org/mailman/listinfo/users>
>
>
>     _________________________________________________
>     users mailing list
>     users at lists.scilab.org <mailto:users at lists.scilab.org>
>     http://lists.scilab.org/__mailman/listinfo/users
>     <http://lists.scilab.org/mailman/listinfo/users>
>
>
>
>
> --
> Samuel Ogbonna Enibe
> BEng (Nig), MSc (Reading, England), PhD (Nig)
> Professor of Mechanical Engineering
> Director, National Centre for Equipment  Maintenance & Development
> University of Nigeria, Nsukka, Nigeria
> Tel: +2348063646798
> Email: samuel.enibe at unn.edu.ng <mailto:samuel.enibe at unn.edu.ng>
> enibesam at yahoo.com <mailto:enibesam at yahoo.com>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>




More information about the users mailing list