From: Rossella on 29 May 2010 09:36 Hi all, I am having some problems in overlaying different objects in the same figure. This seems to be a trivial issue to me, but for some reason it doesn't work properly. What I need to do is: 1) plot an image of class double N-by-M-by-3 (in particular it is the map of a city and it is in tiff format); figure image(img); axis image 2) overlay to the image some points that represent the locations where specific events occurred over the city hold all p = plot(DATA_train(:,2),DATA_train(:,1),'o','markersize',4,'markerfacecolor',color(i,:),'MarkerEdgeColor','k'); % where DATA_train are some points falling inside the area represented by img 3) overlay the convex hull polygon with partial trasparency hold all C = fill(DATA_train(ConvHull,2),DATA_train(ConvHull,1),color(i,:),'FaceAlpha',.3,'EdgeColor',color(i,:)); so far I don't have any problem. The issues arise when I try to: 4) overlay a new image of class double N-by-M (this new image is a matrix representing a density map of the event) with partial transparency: hold all pd = imagesc(Density,'AlphaData',MyAlphaData); % where MyAlphaData is a N-by-M matrix with '0' where the elements of Density are == 0 and a number < 1 where the corresponding elements in the matrix Density are > 0. At this point not only the density image does not appear, but a vertical and horizontal line appear over the figure.... I partially solved the problem setting the property "EraseMode" to 'None' to the handle of the points plot (step 2) and plotting first the density map (step 4) and then the convex hulls (step 3). But the problem is that I need to iterate the process updating the objects and also plotting other 2 groups of data (points, convex hulls and density maps) and the density maps of the other two data groups do not appear. Setting the erase mode property of the density map plot handle to 'none', the density map appears, but it ignores the alpha data matrix for the transparency, thus it completely covers the other objects in the figure. I also tried to play with uistack, but without any success. I tried also with another image and randomly generated data (points, polygons and a matrix) and the problem still arises. I can't figure out what is the cause (maybe the renderer property?....the parent/children setting??....). Please help! :) Any suggestion on the possible cause will be very appreciated! Thanks in advance Rossella
|
Pages: 1 Prev: Any examples and tutorial books on SimMechanics? Next: how to write matrix X |