Clear Filters
Clear Filters

Two colormap in the same plot

60 views (last 30 days)
Cecilia Martinelli
Cecilia Martinelli on 11 May 2021
Answered: Pratyush Roy on 18 May 2021
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
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))])
caxis([-10 10])
axis equal
xlabel('UTM easting (km)')
ylabel('UTM northing (km)')
zlabel('Depth (km)')
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.

Answers (1)

Pratyush Roy
Pratyush Roy on 18 May 2021
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!


Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!