Thank you very much for the quick response. I have tried both options as shown in the sample file below (also attached).
Option 1 using legends works to some extent. However, the style markers are not well indicated in the legend. Option 2 with legend placed before and after the newaxes command shows only the last legend entry. Any assistance to render them more correctly will be greatly appreciated. Samuel Enibe THE SCRIPTS IS AS FOLLOWS ww1 = scf();//new plot windowx1 = 0:10:90;//x1 valuesy1 = [12.27 12.09 11.53 10.63 9.4 7.89 6.14 4.2 2.13 0];//y1 datax2 = 2:-0.5:-2;//x2 datay2 = [4.42 6.01 7.85 9.94 12.27 14.85 17.68 20.74 24.05];//y2 data//OPTION 1 USING legends keywordplot(x1, y1,"-");//first plotxtitle("", "X1 Title", "Y1 Title");gca1 = gca();//get graphic entitiesgca1.children.children.thickness = 3;//set line thikness 3 pixelsgca1.x_location = "bottom";//set x-location to topgca1.y_location = "left";//set to rightbb = newaxes();//create new axes for second plotbb.x_location = "top";//set x-location to topbb.y_location = "right";//set to rightbb.filled = "off";plot(bb, x2, y2, "--");//second plotxtitle("", "X2 Title", "Y2 Title")gca2 = gca();//get graphic entitiesgca2.children.children.thickness = 3;//set line thikness 3 pixelslegends(["Y1 vs X1";"Y2 vs X2"],[1,2],opt="ll"); ww2 = scf();//new plot windowplot(x1, y1,"-");//first plotxtitle("", "X1 Title", "Y1 Title");gca1 = gca();//get graphic entitiesgca1.children.children.thickness = 3;//set line thikness 3 pixelsgca1.x_location = "bottom";//set x-location to topgca1.y_location = "left";//set to rightlegend(gca1,"Y1 vs X1");bb = newaxes();//create new axes for second plotbb.x_location = "top";//set x-location to topbb.y_location = "right";//set to rightbb.filled = "off";plot(bb, x2, y2, "--");//second plotxtitle("", "X2 Title", "Y2 Title")gca2 = gca();//get graphic entitiesgca2.children.children.thickness = 3;//set line thikness 3 pixelslegend(gca2,"Y2 vs X2","ll"); On Wed, Jul 28, 2021 at 10:16 AM CRETE Denis <denis.cr...@thalesgroup.com> wrote: > Hello, > > Try using legends([”A”;”B”],1:2) instead of legend([”A” ;”B”]). > > Alternatively, you may try legend(”A” ) before newaxes if called and > legend(”B”) after. > > HTH > > Denis > > > > *De :* users <users-boun...@lists.scilab.org> *De la part de* Samuel Enibe > *Envoyé :* mercredi 28 juillet 2021 10:16 > *À :* Users mailing list for Scilab <users@lists.scilab.org> > *Objet :* Re: [Scilab-users] Plot Graphs on Different Axes > > > > How can I add legends to the graphics, I tried something like legend > (["A"; "B"]) > > Only the first entry is accepted while the second one is left out. > > > > On Wed, 28 Jul 2021, 09:05 Samuel Enibe, <samuel.en...@unn.edu.ng> wrote: > > Thank you very much Denis and Christopher. I have tried it with the > newaxes command and filled = "off" and it worked. > > > > Thank you very much and God bless you. > > > > > > On Tue, 27 Jul 2021, 17:10 CRETE Denis, <denis.cr...@thalesgroup.com> > wrote: > > Hello, > > I think this should work: > > > > scf(); > plot2d(x1',y1') > a=newaxes(); > plot2d(x2',y2') > a.x_location="top"; > a.y_location="right"; > a.filled="off"; > > > > HTH > > Denis > > > > *De :* users <users-boun...@lists.scilab.org> *De la part de* Samuel Enibe > *Envoyé :* mardi 27 juillet 2021 17:17 > *À :* Users mailing list for Scilab <users@lists.scilab.org> > *Objet :* [Scilab-users] Plot Graphs on Different Axes > > > > I have the following sets of data: > > x1 = [0 10 20 30 40 50 60 70 80 90]; > > y1 = [12.27 12.09 11.53 10.63 9.4 7.89 6.14 4.2 > 2.13 0]; > > x2 = [2 1.5 1 0.5 0 -0.5 -1 -1.5 -2]; > > y2 = [4.42 6.01 7.85 9.94 12.27 14.85 17.67 20.74 24.05]; > > > > I want to plot y1 with x1 (Graph 1) on Bottom x-axis and left y-axis and > y2 with x2 (Graph 2) on Top x-axis and Right y-axis. The axes have > different ranges of values as seen from the example data > > > > What is the simplest way of doing this? > > > > Samuel Enibe > University of Nigeria, Nsukka, Nigeria > > _______________________________________________ > users mailing list > users@lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > > _______________________________________________ > users mailing list > users@lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users >
example402b.sce
Description: application/scilab-sce
_______________________________________________ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users