3

I have several 4 x 4 matrices with data that I would like to represent in a 2-D plot. The plot is supposed to show how the results of a simulation change with varying parameters.

On the y-axis I would like to have the possible values of parameter A (in this case, [10,20,30,40]) and on the x-axis I want to have the possible values of parameter B (in this case, [2,3,4,5]). C is a 4 x 4 matrix with the evaluation value for running the simulation with the corresponding parameter combination.

Example: The evaluation value for the parameter combination A = 10, B = 2 equals 12 dB. I would like to plot it at the cross section A and B (I hope you understand what I mean by this) and code the value by a fat colored dot (e.g. red means high values, blue means low values).

How can I do this? I would basically like to have something like mesh without lines.

I'm sorry for my imperfect English! I hope you understood what I would like to achieve, thank you in advance!

Martin Evans
  • 45,791
  • 17
  • 81
  • 97
Dmitrii C.
  • 45
  • 6
  • Are you at all interested in [`pcolor`](https://www.mathworks.com/help/matlab/ref/pcolor.html) or [this](http://stackoverflow.com/q/3942892/52738) kind of plot, or do you just want big colored circles? – gnovice Apr 26 '17 at 18:21
  • I'd like some big colored circles! I've already tried `pcolor`, but I guess my data is not enough for a useful representation... I would also like to add a `colorbar`, but I guess this should be trivial. – Dmitrii C. Apr 26 '17 at 18:24
  • Thank you for improving my formatting and spelling, Martin! – Dmitrii C. Apr 26 '17 at 20:04

1 Answers1

3

You can do this with the mesh command (and the built-in colormaps you can choose from can be found here, or you could 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:

enter image description here

gnovice
  • 125,304
  • 15
  • 256
  • 359