contourf - putting together 2 contours in matlab. -
i'm making own shakemap (so far, shamemap) matlab. shakemap representation of intensity of ground shaking in map (google more info). want similar usgs, in plot intensity using jet colormap , control shading represent altimetry data. far haven't figured out how this.
i have set of coordinates location's elevation (from nasa's srtm) , in same set of coordinates have parameters of ground shaking.
[lat long srtm]
[lat long groundshaking]
i can contour them separately, if put them in same figure 1 overrides other.
how can put them in same figure? have thought assigning new value each location such new value accounts both measures; locations same groundshaking parameter should same color, if 1 higher 1 should darker. unfortunately don't know how implement this. have thought setting alpha feature manualy, can't make work ground shaking data. suggestions ?
mwe:
x=0:0.01:1; y=0:0.01:1; [xx,yy]=meshgrid(x,y); asd1=zeros(length(x),length(y)); ads2=asd1; i=1:length(x) j=1:length(y) asd1(i,j)=x(i)*y(j); asd2(i,j)=x(i)*x(i)+y(j)*y(j); end end c1=griddata(x,y,asd1,xx,yy, 'linear'); c2=griddata(x,y,asd2,xx,yy, 'linear'); contourf(asd1) contourf(asd2) alpha(0.5)
(mwe unrelated map because data huge)
you need add hold on
first plot not overwritten. nearly works.
colormap gray map1=colormap colormap jet map2=colormap m=[map1;map2]; asd2=asd2*(max(asd1(:))-min(asd1(:)))/(max(asd2(:))-min(asd2(:))); asd2=asd2-max(asd2(:)); colormap(m) caxis([min(asd2(:)) max(asd1(:))]) figure(1) contourf(asd1) figure(2) contourf(asd2)
Comments
Post a Comment