<div dir="ltr"><div>Hi Scilabers</div><div><br></div><div>I can explain a bit more. If I double the number in the colormap (from 5 to 10), then contourf doesn't fail (in the previous code example).</div><div>Then the contour lines only use the first half of the color map (from blue to green) ... maybe it would be better if contour-lines where white. Can I do that, somehow?</div><div><br></div><div>Best regards,</div><div>Claus</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 21, 2018 at 3:55 PM, Claus Futtrup <span dir="ltr"><<a href="mailto:cfuttrup@gmail.com" target="_blank">cfuttrup@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear Scilabers</div><div><br></div><div>In my endeavours to plot radiation pattern for loudspeakers, besides polar plot, I'm also attemptning to view my data with a sonogram (2D contour plot). Here I ask for help to manage the colors of the plot. Here's the code (same reduced data as before):</div><div><br></div><div>// Test data<br>frequencies = [200 2000 20000]; // Hz<br>angles = [0 30 60 90 120 150 180]; // degrees - convert to radians!<br>mag00 = [69.253448 92.163385 87.414209]; // on-axis freq-response<br>mag30 = [68.461357 90.569082 76.073549];<br>mag60 = [65.842262 90.745621 74.152067];<br>mag90 = [59.420658 80.893365 55.975304];<br>mag120 = [52.505173 80.795915 44.363582];<br>mag150 = [53.829987 59.793715 42.443964];<br>mag180 = [55.650341 73.457973 55.608187];<br>magnitudes = [mag00' mag30' mag60' mag90' mag120' mag150' mag180']; <br>// 3 freq x 7 angles = 21 data points, put into a matrix.<br>// In the complete dataset there's 183 frequencies and 72 angles.</div><div><br></div><div>negative_angles = -angles(2:7);<br>neg_angle_magnitudes = magnitudes(:,2:7);</div><div><br></div><div>angles = [angles negative_angles];<br>magnitudes = [magnitudes neg_angle_magnitudes];</div><div>[angles idx] = gsort(angles,'g','i');<br>magnitudes = magnitudes(:,idx);</div><div><br></div><div>// Plot example:<br>contourplt = scf();<br>xset("fpf"," "); // Floating Point Format<br>contourplt.color_map=<wbr>jetcolormap(5); // blue = cold, red = hot :-)<br>contour2d(frequencies,angles,<wbr>magnitudes,50:10:90,logflag="<wbr>ln");<br>contourf(frequencies,angles,<wbr>magnitudes); // FILL with color<br>contour2d(frequencies,angles,<wbr>magnitudes,50:10:90);<br>legends(string(50:10:90),1:5,"<wbr>lr");</div><div><br></div><div>P.S. "funny" - I'm plotting contour2d first, because then I can specify logflag and the numeric labels goes bye-bye. If I execute contourf first, I cannot use log-x-axis. contourf complains that Nax cannot work with log-x-axis data, but contourf fills the plot anyway. I then redo the contour2d to get my contourlines back (because contourf paints over them).</div><div><br></div><div>Help how to get the right colors in the plot would be highly appreciated. In particular contourf complains: Colormap too small</div><div><br></div><div>Can I manage colormap for contour2d and contourf separately?</div><div><br></div><div>Best regards,</div><div>Claus</div></div>
</blockquote></div><br></div>