Discrete Surface Plots (Data visualization)
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am working on visualizing discrete random surfaces (e.g. Ising model). What I would like to be able to do is take the random data (which is an N x N array of 0s and 1s) and plot it in a 2D grid of squares. The squares corresponding to 0s would be blue, the squares corresponding to 1s would be red, let's say. (The end product should look like a "random patchwork quilt," effectively.) Is there a function in matlab ready made for this?
0 comentarios
Respuestas (1)
Star Strider
el 25 de Sept. de 2018
I am not certain what you want.
Hereare two options, the first simply a ‘patchwork’ plane, and the second a 3D bar3 plot:
M = randi([0 1], 7); % Create Matrix
cmap = [1 0 0; 0 0 1]; % Define Red-Blue ‘colormap’
figure
imagesc(M)
colormap(flipud(cmap))
figure
h = bar3(M);
colormap(cmap)
for k1 = 1:numel(h)
q = h(k1).ZData;
h(k1).CData = ones(size(q)).*(q==0);
h(k1).EdgeColor = [1 1 1]*0.8;
h(k1).CData(:,1) = 0;
end
axis equal
You will likely need to experiment to get the result you want with your data.
0 comentarios
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!