two data sets & two colorbars on same figure

2 Ansichten (letzte 30 Tage)
yonatan s
yonatan s am 28 Jan. 2018
Kommentiert: yonatan s am 29 Jan. 2018
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

Antworten (1)

Image Analyst
Image Analyst am 28 Jan. 2018
Use subplot()
subplot(1, 2, 1);
% Now plot first graph or image.
subplot(1, 2, 2);
% Now plot second graph or image.
  1 Kommentar
yonatan s
yonatan s am 29 Jan. 2018
perhaps i wasn't so clear, i was a bit confused myself. the data in "inside circle" correspond to the coordinates in the black circle in "topo". i want the data in figure "insidecircle" to be plot on the same figure as "topo", but with a different colorbars, for example colormap jet.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by