limits - Why doesn't the contourf function in Matlab use the highest value of the plotted data? -


does know why function countourf doesn't use color corresponding maximum value anywhere in plot area?

if try code below, , command get(h_colorbar,'ylim') matlab returns upper limit not highest element of matrix (500), smaller number (475.9091).

as can see commented lines in code, able change upper/lower limits of colorbar, of course doesn't solve problem. i'd matlab use highest values in matrix of data; instance, i'd see point corresponding (200,300) colored in darkest red.

xdata=[7 11 15 19 23 27 31 39 50 75 100 200]; ydata=[50 100 140 150 200 300]; dataz=[...     500 500 438 310 269 253 245 238 235 237 241 500 ...     500 414 291 259 248 244 241 239 239 250 274 500 ...     500 335 268 251 246 243 241 240 242 261 308 500 ...     500 323 264 250 245 243 241 241 243 265 319 500 ...     500 289 256 248 244 243 242 243 248 287 500 500 ...     360 264 250 245 244 243 244 247 261 376 500 500 ...     ]';      % % % in matrix form mdataz=vec2mat(dataz,length(xdata));  [mxdata,mydata]=meshgrid(xdata,ydata);  figure_5=figure; set(gca,'fontname','times new roman', 'fontsize',16,'ycolor','k') hold on box on % % % set(gca,'clim',[min(dataz) max(dataz)]) contourf(mxdata,mydata,mdataz,10) scatter(19,140,50,'k') h_colorbar=colorbar; set(get(h_colorbar,'ylabel'),'string','z','fontname','times new roman', 'fontsize',18) set(h_colorbar,'fontname','times new roman','fontsize',16) % % % set(h_colorbar,'ylim',[200 500],'ytick',[0:50:500]) % % % caxis([200 500]) axis([min(min(mxdata)),max(max(mxdata)),min(min(mydata)),max(max(mydata))]) xlabel('x','fontname','times new roman', 'fontsize',18) ylabel('y','fontname','times new roman', 'fontsize',18) 

any idea?

thanks in advance!

contourf splits data n (10 case) levels. unless specify levels chosen automatically function.

the highest level must lower highest point in data. maybe same, i'm not sure how matlab treats values equal contour in case. if leave automatic contour levels lower.

the individual data points not plotted function, contour heights. therefore, value 500 not in colormap , max height of highest contour.

to solve can put vector of contour values rather n. put highest value close or equal 500.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -