Re: [Scilab-users] Polarplot help
Hi Rafael, et al. I now see that - actually - example 2 of the documentation indeed does plot two graphs. There's no explanation to the example ... sometimes the documentation for Scilab functions is incredibly hard to read for someone who doesn't already know in advance. /Claus On Sun, Jan 21, 2018 at 1:41 PM, Claus Futtrupwrote: > Hi Rafael > > Array notation. After Reading your suggestion I looked at the > documentation of polarplot and this is not explicitly treated, so I missed > that one. Thank you. > > Best regards, > Claus > > On Sun, Jan 21, 2018 at 1:08 PM, Rafael Guerra > wrote: > >> Hi Claus, >> >> >> >> Regarding your problem of not being able to plot all curves in one go >> preserving the scales, if I am not mistaken this can be solved by invoking >> polarplot with a single call using array notation. >> >> See example here below with 2 curves for simplicity: >> >> >> >> *// START OF CODE* >> >> *clf* >> >> t = 0:0.01:2*%pi; >> >> t90 = %pi/2 - t; *//redefine angle-convention consistent with >> loudspeaker plots* >> >> theta = t; *// keep Scilab angles for theta* >> >> rho1 = 1 + sin(t90).^2; *// use new angle mapping for rho1* >> >> rho2 = 1 + 2*cos(t90).^2; *// use new angle mapping for rho2* >> >> *polarplot*([theta,theta], [rho1,rho2]); >> >> a=*gca*(); >> >> set(a,'rotation_angles',[180,0]); *// rotate plot axes* >> >> *// END OF CODE* >> >> >> >> Regards, >> >> Rafael >> >> ___ >> 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
Re: [Scilab-users] Polarplot help
Hi Rafael Array notation. After Reading your suggestion I looked at the documentation of polarplot and this is not explicitly treated, so I missed that one. Thank you. Best regards, Claus On Sun, Jan 21, 2018 at 1:08 PM, Rafael Guerrawrote: > Hi Claus, > > > > Regarding your problem of not being able to plot all curves in one go > preserving the scales, if I am not mistaken this can be solved by invoking > polarplot with a single call using array notation. > > See example here below with 2 curves for simplicity: > > > > *// START OF CODE* > > *clf* > > t = 0:0.01:2*%pi; > > t90 = %pi/2 - t; *//redefine angle-convention consistent with > loudspeaker plots* > > theta = t; *// keep Scilab angles for theta* > > rho1 = 1 + sin(t90).^2; *// use new angle mapping for rho1* > > rho2 = 1 + 2*cos(t90).^2; *// use new angle mapping for rho2* > > *polarplot*([theta,theta], [rho1,rho2]); > > a=*gca*(); > > set(a,'rotation_angles',[180,0]); *// rotate plot axes* > > *// END OF CODE* > > > > Regards, > > Rafael > > ___ > 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
Re: [Scilab-users] Polarplot help
Hi Rafael Thank you. It works. Interesting how the 'set' command alone can do the trick: set(a,'rotation_angles',[180,0]); Excellent. :-) Best regards, Claus On Sun, Jan 21, 2018 at 12:55 PM, Rafael Guerrawrote: > Hi Claus, > > > > For the angles orientation problem in polar plot and correct labelling, > here below a simple solution: > > > > *// START OF CODE* > > *clf* > > t = 0:0.01:2*%pi; > > t90 = %pi/2 - t; *//redefine angle-convention consistent with loudspeaker > plots* > > theta = t; *// keep Scilab angles for theta* > > rho = -1 + sin(t90); *// use new angle mapping for rho* > > *polarplot*(theta, rho); > > a=*gca*(); > > set(a,'rotation_angles',[180,0]); *// rotate plot axes* > > *// END OF CODE* > > > > Regards, > > Rafael > > ___ > 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
Re: [Scilab-users] Polarplot help
Hi Claus, Regarding your problem of not being able to plot all curves in one go preserving the scales, if I am not mistaken this can be solved by invoking polarplot with a single call using array notation. See example here below with 2 curves for simplicity: // START OF CODE clf t = 0:0.01:2*%pi; t90 = %pi/2 - t; //redefine angle-convention consistent with loudspeaker plots theta = t; // keep Scilab angles for theta rho1 = 1 + sin(t90).^2; // use new angle mapping for rho1 rho2 = 1 + 2*cos(t90).^2; // use new angle mapping for rho2 polarplot([theta,theta], [rho1,rho2]); a=gca(); set(a,'rotation_angles',[180,0]); // rotate plot axes // END OF CODE Regards, Rafael ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Polarplot help
Hi Claus, For the angles orientation problem in polar plot and correct labelling, here below a simple solution: // START OF CODE clf t = 0:0.01:2*%pi; t90 = %pi/2 - t; //redefine angle-convention consistent with loudspeaker plots theta = t; // keep Scilab angles for theta rho = -1 + sin(t90); // use new angle mapping for rho polarplot(theta, rho); a=gca(); set(a,'rotation_angles',[180,0]); // rotate plot axes // END OF CODE Regards, Rafael ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Polarplot help
Hi Philippe Thank you for the pointer. It works. To everybodys amusement, here comes a script (with data reduced from more than 13000 to 21, so it can be posted here). The reason is I have a new problem. Plotting in this case 3 set of data, polarplot seems to auto_scale and turning it off doesn't work (??). Please see this one: // Test datafrequencies = [200 2000 2]; // Hzangles = [0 30 60 90 120 150 180]; // degrees - convert to radians!mag00 = [69.253448 92.163385 87.414209]; // on-axis freq-responsemag30 = [68.461357 90.569082 76.073549];mag60 = [65.842262 90.745621 74.152067];mag90 = [59.420658 80.893365 55.975304];mag120 = [52.505173 80.795915 44.363582];mag150 = [53.829987 59.793715 42.443964];mag180 = [55.650341 73.457973 55.608187];magnitudes = [mag00' mag30' mag60' mag90' mag120' mag150' mag180']; // 3 freq x 7 angles = 21 data points, put into a matrix.// In the complete dataset there's 183 frequencies and 72 angles. negative_angles = -angles(2:7);neg_angle_magnitudes = magnitudes(:,2:7); angles = [angles negative_angles];magnitudes = [magnitudes neg_angle_magnitudes]; [angles idx] = gsort(angles,'g','i');magnitudes = magnitudes(:,idx); // Polar plot example: polplt = scf(); p = gca(); // p = "polarplot" ... how ingenious :-/ polarplot(%pi*angles/180,magnitudes(1,:)); p.auto_scale = "off"; polarplot(%pi*angles/180,magnitudes(2,:)); // index 2 = 2 kHz polarplot(%pi*angles/180,magnitudes(3,:)); legend("200 Hz","2 kHz","20 kHz"); p = gca(); // p = "polarplot" ... how ingenious :-/ idx=find(p.children.type=="Text"); p.children(idx).visible="off"; My "problem" is I cannot just specify polarplot to plot all three curves in one go. So I execute one at the time, but now see the axis changes for each of them (in the same figure)... I hope it makes sense what I'm trying to do and my problem is understandable. Best regards, Claus On Sat, Jan 20, 2018 at 4:21 PM, philippewrote: > Hi, > > Le 20/01/2018 à 11:08, Claus Futtrup a écrit : > > > > > > How can I rotate the labels of the polarplot so that zero is up the > > y-axis instead of out the x-axis? Alternatively, how can I disable the > > labels? > > look at the Axis handle, the labels of a polar plot are additional > children of "Text" . Try this example : > > > clf > t = 0:0.01:2*%pi; > polarplot(t, -1 + sin(t)); > A=gca() // get the axis handle > A.children// look at all its children > //The labels are those of "Text" type > id=find(A.children.type="Text" )// get their id > //then modify the properties of the handles > A.children(id).visible="off" // no labels > A.children(id).visible="on" // all labels > A.children(id).text="mylabel" // change labels > for k=id > A.children(k).text=string(k); > end > > > Philippe > > ___ > 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
Re: [Scilab-users] Polarplot help
Hi, Le 20/01/2018 à 11:08, Claus Futtrup a écrit : > > > How can I rotate the labels of the polarplot so that zero is up the > y-axis instead of out the x-axis? Alternatively, how can I disable the > labels? look at the Axis handle, the labels of a polar plot are additional children of "Text" . Try this example : clf t = 0:0.01:2*%pi; polarplot(t, -1 + sin(t)); A=gca() // get the axis handle A.children// look at all its children //The labels are those of "Text" type id=find(A.children.type="Text" )// get their id //then modify the properties of the handles A.children(id).visible="off" // no labels A.children(id).visible="on" // all labels A.children(id).text="mylabel" // change labels for k=id A.children(k).text=string(k); end Philippe ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
[Scilab-users] Polarplot help
Dear Scilabers This weekend I'm trying to do some polar plots and experiment with GUI. What I'm trying to do is quite similar to Example 3 in the help: https://help.scilab.org/docs/6.0.0/en_US/polarplot.html I work with loudspeakers and in our industry it's standard to have the zero degree angle up the y-axis (as in above Example 3). How can I rotate the labels of the polarplot so that zero is up the y-axis instead of out the x-axis? Alternatively, how can I disable the labels? Best regards, Claus ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users