a.k.a. look at a 3D bar graph color-coded by height in plan view
Say you have a reasonably-sized matrix and you want to look for patterns in it. Let's define reasonably-sized as something on the order of 15 by 15, you care about what each value is, but it would be tedious to scan the matrix of numeric values.
Say your matrix is Z, maybe it is a 14x24 matrix of different exponents from polynomial fits to different variables using different thresholds or statistical parameters.
surface(Z) won't do exactly what you want because the values in the matrix will be the vertices of the surface, you want each grid box to be color-coded with the matrix values.
One way to do this is to make a 3D bar plot, color the bars by their height (matrix value), and then look at it in plan view. It's sort of cool.
figure;
h = bar3(Z);
% http://www.mathworks.com/help/techdoc/creating_plots/f10-19972.html
% Tell handle graphics to use interpolated rather than flat shading
shading interp
% For each barseries, map its CData to its ZData
for i = 1:length(h)
zdata = get(h(i),'ZData');
set(h(i),'CData',zdata)
% Add back edge color removed by interpolating shading
set(h,'EdgeColor','k')
end
colormap('default')
colorbar;
grid off;
view([0,90])
% you can manipulate the axes (xmin xmax ymin ymax zmin zmax colorbarmin colorbarmax)
axis([0 25 0 15 0 1 0.8 1])
Here's the original document I got the code from:
http://www.mathworks.com/help/techdoc/creating_plots/f10-19972.html
Here's an example of the output.
The rows, 1-14 are 14 different polynomial fits.
The columns, 1-24 are 24 different ways of calculating the x variable in the fit (different thresholds or filters).
The value is the Rsquare value, colorbar color codes it from 0.8 to 1.0.
The matrix shows that the 1st and 23rd-25th columns have the worst fits for all 14 relationships. Also, rows 4, 5, 11, 12, 14 do not produce well-behaved polynomial fits.
Really I just think it's a nice quilt pattern.
As an added plus you can use the rotate button to look at it from any angle you want.
Tuesday, November 8, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment