1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2// Copyright (C) 2010 Samuel GOUGEON 3// Copyright (C) 2010 - DIGITEO - Allan CORNET 4// 5// This file is released under the 3-clause BSD license. See COPYING-BSD. 6 7function demo_plotyyy() 8 9 // DEMO START 10 // A plotyyy() example: //http://bugzilla.scilab.org/show_bug.cgi?id=6070 11 12 my_handle = scf(100001); 13 clf(my_handle); 14 15 // Preparing data 16 x = linspace(1,30,200); 17 y2 = exp(x/6).*(sin(x)+1.5); 18 y3 = 1+x.^2; 19 20 drawlater() 21 demo_viewCode("plotyyy.dem.sce"); 22 23 // Axis y1 24 y1=sin(x/2); 25 plot2d(x,y1) 26 xtitle([gettext("Plot with 3 different Y scales at shared X");" "],.. 27 gettext("Common X axis"),gettext("Scale #1")); 28 29 // Axis y2 30 c=color("blue"); 31 na=newaxes(); 32 na.foreground=c; 33 na.font_color=c; 34 plot2d(x,y3,logflag="nl",style=c) 35 na.children(1).children(1).thickness=2; 36 na.filled="off"; 37 na.axes_visible(1)="off"; 38 na.axes_reverse(2)="on"; 39 na.y_location="middle"; 40 41 // Axis y3 42 c=color("red"); 43 na=newaxes(); 44 na.foreground=c; // Axis and ticks color 45 na.font_color=c; // Labels's color 46 plot2d(x,y2,style=c); 47 ylabel("Scale n°3","color",[1 0 0]) 48 na.filled="off"; // Transparent background, letting the first plot appearing 49 na.axes_visible(1)="off"; // Masking the x axis (useless overlay) 50 na.y_location="right"; // Y axis on the right side 51 na.children(1).children(1).thickness=2; // Curve thickness 52 53 drawnow() 54 55 // DEMO END 56 57endfunction 58 59demo_plotyyy(); 60clear demo_plotyyy; 61