two data sets & two colorbars on same figure
2 次查看(过去 30 天)
显示 更早的评论
I have a figure representing a topographic map. after plotting it, i want to change the values within the circle for values ranging from 0 to 1 according to some criteria (variable zp in the code).
in the final figure i want to present both the topographic map and the map within the circle, but to use different colorbar for them.
so, a couple of questions:
1. the value within the circle is a scalar field, so how do i plot it?
2. how do i create a separate colorbar only for the data within the circle?
here's the code (unfortunately maps.mat is too big for uploading):
if ~exist('TOPO','var')
load('maps.mat');
end
z=TOPO; ppd=512;
%z=TOPOels; ppd=128;
R=1737;
kmpd=2*pi*R/360;
res=kmpd/ppd;
r=7.5;
lat0=-38;
x=(1:size(z,2))*(res*cosd(lat0));x=x-mean(x);
y=(1:size(z,1))*(res); y=y-mean(y);
imagesc(x,y,z); axis tight ij equal; hold on;
plot(sin(th)*r,cos(th)*r,'-k'); hold on;
[yy,xx]=ndgrid(y,x);
th=linspace(0,2*pi);
d=sqrt(xx.^2+yy.^2)*1e3;
azbw=1;
azbins=-180:azbw:180;
f=find(d<r*1e3);
slaz=zeros(size(f));
% zzr=zeros(size(f));
for i=1:50 %length(f)
xxr=xx-xx(f(i)); yyr=yy-yy(f(i));
az=atan2d(yyr,xxr);
d=sqrt(xxr.^2+yyr.^2)*1e3;
h=z-z(f(i));
h=h-d.^2/(2.*R*1e3);
sl=atand(h./d);
fd=find(d>3*res*1e3);
slfd=sl(fd);
idx=find(slfd(:)>3);
slaz=unique(round(az(idx))); % in what azimuths relative to the point are obstacles
zp(i)=length(slaz)/length(azbins);
%%% now i want to plot zp(i) in the point (xx(f(i)),yy(f(i)))
end
0 个评论
回答(1 个)
Image Analyst
2018-1-28
Use subplot()
subplot(1, 2, 1);
% Now plot first graph or image.
subplot(1, 2, 2);
% Now plot second graph or image.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!