[Scilab-users] filled contour plot

Rafael Guerra jrafaelbguerra at hotmail.com
Sun Jan 21 21:38:01 CET 2018


Hi Claus,

Please check code below which produces the plot herein.
Optionally you can add contours to it.
However the contour level labels do not seem to display on such log-plots. A
possible contour2d bug?

<http://mailinglists.scilab.org/file/t495698/contourf_colorbar.gif>  

//START OF CODE
frequencies = [200 2000 20000]; // Hz
angles = [0 30 60 90 120 150 180]; // degrees - convert to radians!
mag00 = [69.253448 92.163385 87.414209]; // on-axis freq-response
mag30 = [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'];

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);

clf;
nz = 40:10:90;
nz2 = 40:1:90;
cplot = gcf();
cplot.color_map= jetcolormap(length(nz2)); // blue = cold, red = hot :-)
contour2d(frequencies,angles,magnitudes,nz,logflag="ln");
contourf(frequencies,angles,magnitudes,nz2);
cplot.children.data_bounds = [200,-180;2e4,180];
// contour2d(frequencies,angles,magnitudes,nz,logflag="ln");  // Optionally
add contours
// xset("fpf","%.0f");   // bug? not working for logarithmic axes...
colorbar(min(magnitudes),max(magnitudes))
xlabel("frequency [Hz]");
ylabel("angle (deg)");
//END OF CODE

Regards,
Rafael




--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html



More information about the users mailing list