Two colormap in the same plot
조회 수: 25 (최근 30일)
이전 댓글 표시
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/614245/image.png)
Thanks
댓글 수: 0
답변 (1개)
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Orange에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!