![img1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240793/img1.png)
Fill line with colors using the heatmap
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hey everyone,
I'm currently trying to use the function:
plot
to create af figure similar to this:
![Plot_How.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240785/Plot_How.png)
Does anyone know how to use the heatmap function with the plot function?
Thanks,
Eric
0 commentaires
Réponse acceptée
darova
le 2 Oct 2019
What about pcolor()
clc,clear
n = 50;
x = linspace(-5,5,n);
[X,Y] = meshgrid(x);
for i = 1:n
y = sinc(x(i))+0.5;
Y(:,i) = linspace(0,y,n);
end
Z = Y;
h = pcolor(X,Y,Z);
% set(h,'edgecolor','none')
shading interp
colorbar
![img1.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/240793/img1.png)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Distribution Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!