Histogram or heatmap with self-defined values.

19 visualizaciones (últimos 30 días)
Lukas Schmid
Lukas Schmid el 6 de Oct. de 2022
Editada: Adam Danz el 7 de Oct. de 2022
Hello all,
I would like to have a heatmap or histogram 2D (whichever works better) that plots values in the boxes I specify.
Example:
X = [1;2;3];
Y = [10;20;30];
mainvalue = [4;76;8];
array = [X,Y,mainvalue];
So if X has the value 2 and Y has the value 20, for example, then mainvalue has the value 76.
Basically I try to change the height of the bins with fixed values from a vector (here mainvalue).
This is how it should look, except that the bins contain the values of mainvalue:
Axis labeling does not match example!
  4 comentarios
Lukas Schmid
Lukas Schmid el 7 de Oct. de 2022
But in that case is there no option how to display the data with a vector like in my example image?
So that each x and y value is also assigned a mainvalue value and I then plot this as a box in the histogram?
Adam Danz
Adam Danz el 7 de Oct. de 2022
I've replied with an answer below.

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 7 de Oct. de 2022
Editada: Adam Danz el 7 de Oct. de 2022
You have (x,y) coordinates and my interpretation is that you'd like to use color or another property to represent a third value mainvalue. One option is a scatter plot:
X = [1;2;3];
Y = [10;20;30];
mainvalue = [4;76;8];
scatter(X,Y,100,mainvalue,'filled'); % 3rd arg defines size
cb = colorbar();
ylabel(cb, 'mainvalue')
axis padded
box on
grid on

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by