How to superpose pcolor and plot on the same figure?
29 ビュー (過去 30 日間)
古いコメントを表示
I try to superpose points with plot on pcolor and I only get the plot or the pcolor which is the furthest in the code lines.
I try to switch orders but I can't find the right way to get the points of plot and the pcolor on the same figure.
Refer to figure matlab_fig1.fig for the plot command and to matlab_fig2.fig for the pcolor command.
Here is my code:
figure(1)
hold on;
colormap(jet);
clf;
plot(xdomain,ydomain,'r+'); % refer to --> matlab_fig1.fig DOES NOT APPEAR
pcolor(diff); % refer to --> matlab_fig2.fig I ONLY GET THIS LINE
colorbar;
caxis([-1, 1]);
colorbar('Ticks',[-1,0,1]);
shading flat;
figure(gcf);
Thank you
0 件のコメント
採用された回答
TADA
2021 年 6 月 29 日
You call clf() after changing hold status to 'on'
this clears your figure, therefore resets your hold status to 'off'.
move clf() before your hold on; statement:
figure(1)
clf;
hold on;
colormap(jet);
plot(xdomain,ydomain,'r+'); % refer to --> matlab_fig1.fig DOES NOT APPEAR
pcolor(diff); % refer to --> matlab_fig2.fig I ONLY GET THIS LINE
colorbar;
caxis([-1, 1]);
colorbar('Ticks',[-1,0,1]);
shading flat;
figure(gcf);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Animation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!