- Plot the heatmap
- Add axes over the heatmap
- Plot lines on the axes
- Set the background color of the axes to 'none'
- Adjust the axes size to fit to the heatmap
Overlay curves over heatmap
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
or ohev shalom
el 25 de Dic. de 2019
Respondida: Ahmed
el 27 de Ag. de 2024
Hello everyone,
I was wondering if it is possible to plot curves over heatmap. It goes something like this:
X = 20:20:1000;
Y = 100:-2:1;
Z = randi(100,50,50);
h = heatmap(X,Y,Z);
hold on
for ii=1:5
curve = ii+1000./X;
plot(X, curve)
end
hold off
I want the curves to be above the heatmap. For example, in the figures below,
the right figure should be on top of the left figure.
Any ideas?
Thanks in advance!
0 comentarios
Respuesta aceptada
Akira Agata
el 26 de Dic. de 2019
How about the following way?
The following is an example.
% Sample data
cdata = [45 60 32; 43 54 76; 32 94 68; 23 95 58];
figure
heatmap(cdata)
colorbar
ax = axes;
plot(ax,magic(4),'LineWidth',2)
ax.Color = 'none';
% Maybe it needs some adjustment, like:
ax.Position(3) = 0.72;
ax.XTick = [];
ax.YTick = [];
3 comentarios
Chamila Siyamalapitiya
el 24 de Ag. de 2021
How to apply this concept for subplot? when use ax = axes, it use the whole space, not the subplot space
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!