matlab

정점 수심 (scatter) colorbar 연동

humming_stereo 2023. 2. 24. 13:08

scatter를 contour처럼 colorbar에 연동해서 적용


clc; clear; close all;
%% input
x=.5:9.5;
y=x;
z=randi([0 10],1,length(x));
%% figure
figure('Visible','on')
% plot
scatter(x,y,75,z,'filled','MarkerEdgeColor','r')
% colorbar
c = colorbar;
c.Label.String = 'depth (m)';
clim([1 10])
colormap gray
% legend
legend('depth','Location','southeast')
% deco
xlim([0 10])
ylim([0 10])
xticks(0:1:10)
yticks(0:1:10)
xlabel(['longitude',char(176)])
ylabel(['latitude',char(176)])
title('coordinate\_depth')
% set
set(gca,'fontname','Arial','fontweight','bold','fontsize',15,'Box','on','linewidth',2,'Layer','top');
set(gcf,'color','w','Units','Normalized','OuterPosition',[0.2 0.2 .45 .65]);