Hi Rafael These examples are an enormous help to me. I can say for sure, I would have never found out by reading the documentation. The "refmat" is new to me. I now see how you can "stack" several colormaps with the plot, simply f. color_map = [f.color_map; name2rgb(cntcolorname)]; ... the semicolon gives space to a new one. I see how you call contour2d with the style option the second time. Supposedly the default is the first one, but you invoke the second one with the style option. I see how you now define the length of the colorbar because if you don't, then the colorbar will paint both colormaps on the bar :-/
Thank you for suggesting the grey colors, it works excellent together with the jetcolors. Best regards, Claus On Mon, Jan 22, 2018 at 8:51 PM, Rafael Guerra <[email protected]> wrote: > Hi Claus, > > Yes, you can use different colors for the contours. > See sample code here below which displays grey contours but could be > adapted > to display contours with different colors for each contour level. > > <http://mailinglists.scilab.org/file/t495698/contour2d_ > logscale_colorfiled_colored_contour.png> > > //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; > zn = 40:10:90; > nz = length(zn); > zn2 = 40:0.5:90; > nz2 = length(zn2); > f = gcf(); > f.color_map= jetcolormap(nz2); > contour2d(frequencies,angles,magnitudes,zn,logflag="ln"); > contourf(frequencies,angles,magnitudes,zn2); > f.children.data_bounds = [200,-180;2e4,180]; > xset("fpf","%.0f"); // bug? not working for logarithmic axes... > cntcolorname = "grey"; // define contour color > cntcolor = color(cntcolorname); > cntcolor = repmat(cntcolor, 1, nz); // define array with as many colors as > contours > f.color_map = [f.color_map; name2rgb(cntcolorname)]; > contour2d(frequencies,angles,magnitudes,zn,style=cntcolor,logflag="ln"); > e = gce(); > N = length(e.children); > for i = 1:nz-1 > e.children(i).children.line_style = 2; // dashed contours > end > > colorbar(min(magnitudes),max(magnitudes),[1 nz2]) > xlabel("frequency [Hz]"); > ylabel("angle (deg)"); > //END OF CODE > > Regards, > Rafael > > > > -- > Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing- > Lists-Archives-f2602246.html > _______________________________________________ > users mailing list > [email protected] > http://lists.scilab.org/mailman/listinfo/users >
_______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
