[scilab-Users] Plotting data with single x axis and two y axes

Giri giri at leos.gov.in
Mon Feb 15 18:33:41 CET 2010


Samuel Gougeon wrote:

> Hello Giri,
> Here is a commented example showing a way to do what you expect.
> There are certainly other ones, noticeably by using drawaxis()
> instead of | in addition to newaxes();
> Hope That Help
> Regards
> Samuel
> --------
> x=linspace(1,7,100);
> y1=sin(x);
> y2=cos(x)*67;
>
> clf
> plot2d(x,y1);
> xtitle("Sample with 2 different Y-scales","X","sinus(x)")
> legend("sin(x)",-5,%f); // -5 => above the left top corner, no frame
> a=newaxes();    // Creates a new default system of axes on the same
> area of the window, and makes it the current one
> a.filled="off"; // the background of the graphical area should be
> transparent, to leave the previous plot apparent
> red=color("red");
> plot2d(x,y2,axesflag=3,style=red);  // plots new data. axesflag=3
> means X at the bottom, and Y at the right
> // Because the default
> legend("67.cos(x)",[6,100],%f);     // above the right top corner, no frame
> a.font_color=red;                   // sets color for ticks labels
> a.axes_visible=["off","on","off"];  // cancels x axis (else red)
> a.y_label.font_foreground=red;   // sets color for y-label
> a.y_label.text="67.Cosinus(x)";  // set y label
>

Hello Samuel:
Thank you very much for the code you have posted. The result is exactly what I
had in mind. Your commented lines are very helpful and I have learned a few
'tricks' from them.
Sincerely
Giri.


----------------------------------------------------------------
This mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. LEOS has taken every reasonable precaution to remove any viruses however you should also carry out your own virus checks before opening the e-mail or attachment. 





More information about the users mailing list