Kau
Kau

Reputation: 3

How to plot 3D heat map in Matlab

I have (x,y,z) coordinates with measured values called (w) corresponding to these (x,y,z) coordinates. I want to produce a heat map for the measured value (w) in 3D. Is there anyway to do that.

Upvotes: 0

Views: 1099

Answers (1)

tyogi
tyogi

Reputation: 650

Before answering, I tried to know more about the dimensions of your cube in order to understand what type of solutions might exist. Unfortunately, since this is not specified at this stage, answers might not be applicable, nevertheless let's shoot for some:

  • you are trying to plot a 3D cube, in which a 4th dimensional "color" corresponds to your "w" values. The "inside" of this cube will therefore not be visible in a 3D object (even with transparency, the inside "heatmaps" will not be visualizable). If this part is still confusing, think of a 6 by 6 rubik's cube : the colors of the mini-cubes "inside" are not visible, and even if the outer colors were semi-transparent the inner colors wouldn't render in a way that would be interpretable.
  • a first solution, depending on the dimensions and their meaning, would be to choose a dimension and show cross-sectional heatmaps. For example, for a housing market study, if x measures the size of the house, y measures the proximity to a city, and z measures the number of rooms (say with modalities 1,2,3,4,5,6), and w is the price, it could make sense to plot six 2D heatmaps with the x and y axes, one heatmap for each of the "room" modalities.
  • another solution, if we stay with this example but now z represents the year of purchase from, say, 1921 to 2020, then we can again show yearly cross-sections, but this time in a video which shows the evolution of the heatmap. It is fairly easy to export a Matlab video from successive heatmaps, and you could pause for example a tenth of a second for each year in which case this example would lead to a 10-second video (100 years).

Happy visualizing!

Upvotes: 1

Related Questions