Two colormap in the same plot

51 ビュー (過去 30 日間)
Cecilia Martinelli
Cecilia Martinelli 2021 年 5 月 11 日
回答済み: Pratyush Roy 2021 年 5 月 18 日
Hello everyone,
I would like some help to plot two colormap in the same plot. I'm new to MatLab so I have still a lot to learn.
I have two dataset that I would like to plot with different colors. Here is my code, where I managed to plot them but just one has colors (trisurf). Now, I would like to plot in a different colormap (Parula) the dataset represented by the points in the figure (scatter), with a range between 0 and 100 cm.
% segment 12
subplot(2,2,1)
trisurf(tri_12,xf_12./1e3,yf_12./1e3,zf_12./1e3,ds_12,'EdgeColor','k','LineWidth',0.1)
hold on
scatter(coord(1:datind(1),1)./1e3,coord(1:datind(1),2)./1e3,20,d,'filled','MarkerEdgeColor','k') %
title(['Dip slip - segment 12',num2str(smth),',',num2str(SMOOTH(smth))])
view(az,el)
hcb=colorbar;
mycolormap=flipud(mymap);
colormap(mycolormap)
title(hcb,'m')
caxis([-10 10])
axis equal
xlabel('UTM easting (km)')
ylabel('UTM northing (km)')
zlabel('Depth (km)')
set(get(gca,'xlabel'),'rotation',35)
set(get(gca,'ylabel'),'rotation',-10)
Anyone can help me? I tried to adsjut my code following this answer but it didn't work, mainly because I think I didn't fully understand how to do.
Thanks

回答 (1 件)

Pratyush Roy
Pratyush Roy 2021 年 5 月 18 日
Hi Cecilia,
The MathWorks Support Team has shared an answer with the community regarding how to use multiple colormaps in a single plot. The link to the answer is given here.
Hope this helps!

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by