![]() If not you can use surf (and possibly duplicate the last column and row and one more "(end,end)" value - although that's a kind of a dirty approach). Note how you can use the "set(gca, 'YTick'." (and Xtick) command to set the x and y tick labels properly if x and y are not 1:1:N.Īlso note that imagesc only makes sense if your z data correspond to xs and ys are (each) equally spaced. (You can also see this in images in the other answers.) Surf(x,y,z,'EdgeColor','None'), view(2), axis equal tight, colorbarĪs you can see the 10th row and 5th column are missing in the surf plot. Imagesc(flipud(z)), axis equal tight, colorbar To illustrate these 2 points, I produced the figure below with the following code: = meshgrid(1:10,1:5) The surf and the imagesc examples in gevang's answer only (almost - apart from the last row and column) correspond to each other because the 2D sinc function is symmetric. On the other hand, using imagesc, you have to be careful with the axes. Note that both pcolor and "surf + view(2)" do not show the last row and the last column of your 2D data. Surf(X, Y, Z,'EdgeColor', 'None', 'facecolor', 'interp') As points out, here is a smoothed, equal-axis, no-axis labels maps, adapted to this example: figure In a live MATLAB figure window, this plot would allow interactive exploration of the data values, using data cursors. Update/Refining the map: Several design options on the map (resolution, smoothing, axis etc.) can be controlled by the regular MATLAB options. The color pallet of the map is controlled by colormap(map), where map can be custom or any of the built-in colormaps provided by MATLAB: or treating the values in Z as a matrix, viewing it as a scaled image using imagesc and selecting an appropriate colormap. = meshgrid(-8.5:8) ĢD map: You can get a 2D map by switching the view property of the figure % 2D map using view You can additionally use surf for filled surface patches and set the 'EdgeColor' property to 'None' (so the patch edges are non-visible). By default mesh will color surface values based on the (default) jet colormap (i.e. ![]()
0 Comments
Leave a Reply. |