MATLAB heat map

后端 未结 4 1079
时光取名叫无心
时光取名叫无心 2020-12-17 16:39

I am trying to create a heat map using MATLAB, but the default function in MATLAB program doesn\'t any sense to me.

http://www.mathworks.com/help/bioinfo/ref/heatmap

相关标签:
4条回答
  • 2020-12-17 16:48

    The MATLAB contourf command may by useful to you.

    0 讨论(0)
  • 2020-12-17 17:08

    I'm not sure what you're actually trying to accomplish, but I think you might want to use colormap{}. If you're trying to create a classic "heatmap", then colormap is the function you want. Basically, if you've got x,y position, and a Z value that you want to represent as a color, this is the trick for you.

    0 讨论(0)
  • 2020-12-17 17:08

    You can use the Plotly MATLAB API to make a heatmap. Try this:

    r = plotly({struct('z',randn(50,50), 'type','heatmap')}) % => https://plot.ly/~matlab_example/18dos(['open ', r.url])
    

    this heatmap

    You can see the interactive version and installation here.

    Disclosure, I am on the Plotly team.

    0 讨论(0)
  • 2020-12-17 17:11

    HeatMap isn't actually standard function for this, it comes from the Bioinformatics Toolbox. The simple way of drawing a heatmap might be like:

     A = 1:50;          % matrix to draw
     colormap('hot');   % set colormap
     imagesc(A);        % draw image and scale colormap to values range
     colorbar;          % show color scale
    

    As @natan suggested, you might want to build your matrix first and then draw using image or imagesc. Also you migt want to see article on my blog which shows that some color sets are better for accessibility than others, e.g. for printing in grayscale or in color vision deficiency.

    0 讨论(0)
提交回复
热议问题