I have a 50x50 matrix with some numbers ranging from 0 to a bit over 1. How do I show a heatmap of this data with a colorbar? What I'm looking for is a plot where the x
and y
values range from 1
to 50
and 1
to 50
, with each point (x
, y
) given a color corresponding to the size of the data at the matrix entry (x
, y
). For an example of such a heatmap, check out this amusing xkcd post.
Thanks!
Create a matrix of data. Then create a heatmap of the matrix values. Use custom labels along the x-axis and y-axis by specifying the first two input arguments as the labels you want. Specify the title and axis labels by setting properties of the HeatmapChart object.
Use the plot function to display the heatmap in another figure specified by the figure handle fH . fH = figure; hA = plot(hmo,fH); Use the returned axes handle hA to specify the axes properties.
plot3( X , Y , Z ) plots coordinates in 3-D space. To plot a set of coordinates connected by line segments, specify X , Y , and Z as vectors of the same length. To plot multiple sets of coordinates on the same set of axes, specify at least one of X , Y , or Z as a matrix and the others as vectors.
What do you think about this example? see also?
>> A = randi([10,60],100,100);
>> colormap('hot')
>> imagesc(A)
>> colorbar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With