Color Representation of Data in 2D Plot (in MATLAB)
I have several 4 x 4 data matrices that I would like to represent in a 2D plot. The graph is supposed to show how the simulation results change with different parameters.
On the y-axis, I would like to have possible values ββfor the A parameter (in this case [10,20,30,40]
), and on the x-axis, I want to have possible values ββfor the B parameter (in this case [2,3,4,5]
). C is a 4 Γ 4 matrix with an estimate to run the simulation with the appropriate combination of parameters.
Example: the estimated value for the combination of parameters A = 10
, B = 2
is 12 dB. I would like to plot it in cross section of A and B (I hope you can see what I mean) and encode the value with a thick colored dot (for example, red means high values, blue means low values).
How can i do this? I would like to have something like mesh
no lines.
Sorry for my imperfect English! I hope you understand what I would like to achieve, thanks in advance!
source to share
You can do it with mesh
(and built-in color maps can be found that you can choose from here , or you can even make your own):
[A, B] = meshgrid(10:10:40, 2:5); % Grids of parameter values
C = rand(4); % Random sample data
hMesh = mesh(A, B, C); % Plot a mesh
set(hMesh, 'Marker', '.', ... % Circular marker
'MarkerSize', 60, ... % Make marker bigger
'FaceColor', 'none', ... % Don't color the faces
'LineStyle', 'none'); % Don't render lines
colormap(jet); % Change the color map
view(0, 90); % Change the view to look from above
axis([5 45 1.5 5.5]); % Expand the axes limits a bit
colorbar; % Add colorbar
And here's the plot:
source to share