MATLAB Answers

0

How to insert a line over a heatmap using code?

Asked by Samantha Clayton on 14 Jun 2018 at 19:34
Latest activity Commented on by Walter Roberson
on 15 Jun 2018 at 7:37

How can I insert a line over a heatmap in my code? I would rather not use the figure tools manually because I have to do multiple lines.

  0 Comments

Sign in to comment.

1 Answer

Answer by Robert Uhlig on 15 Jun 2018 at 6:48

Hi Samantha Clayton:

Since I do not know your code I can only demonstrate in the following example how to draw a vertical and a horizontal line into a contourf-plot (assuming you mean something like that).

 Z = peaks(20);
 ah = axes;
 h = contourf(Z,10,'Parent',ah);
 hold(ah,'on')
 plot(ah,[0 25],[10 10],'white') % horizontal line
 plot(ah,[10 10],[0 25],'white') % vertical line
 ah.XLim = [2 20];
 ah.YLim = [2 20];

There is a HeatMap-Command in Bioinformatics toolbox, so I do not know whether same strategy is working for that.

Kind regards,

Robert

  1 Comment

New MATLAB also have heatmap().

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today