Prev: Serial communication blocks of real-time windows target do not
Next: simulink error while conversion from serial to parallel using buffer
From: Stephan Jaiser on 19 May 2010 15:26 Hi, I am trying to draw a complex stairstep plot, seek some coordinates via ginput and then superimpose a transparent patch to highlight an area of interest. It all works well until I set the alpha value on the patch, which has some detrimental effects on the previously drawn figure and any subsequent ginput. I am running Matlab R2009a 64bit on Win 7 but have found similar issues with Matlab 2007a. The following code demonstrates the problem: figure(1); hold on; axis([-0.5 1.5 -0.5 1.5]); plot([-0.4,1.4],[1.4,-0.4],'k'); plot([-0.4,1.4],[-0.4,1.4],'k'); stairs([-0.5,0,0.5,1,1.5],[-0.5,0,0.5,1,1.5],'linewidth',5); h=patch([0,0,1,1,0],[0,1,1,0,0],'k'); [x,y]=ginput(1); set(h,'linewidth',0.2); set(h,'facealpha',0.2); [x,y]=ginput(1); If stepped through in debug mode, everything works as intended up to the penultimate line. Setting 'facealpha' has several effects: (1) it makes the patch semi-transparent, as intended (2) there is a subtle (?1 pixel) movement of the axes and figure elements (3) the stairstep plot suddenly develops jagged instead of smoothed corners (4) the subsequent ginput has a haircross cursor which is twice the previous thickness, and the cursor is noticeably slow to follow mouse movements. The fact that this does not happen with the preceding 'set' appears to indicate that this problem may be specific to setting the alpha value. I would be grateful for any assistance - I can live with (4), but (2) and (3) corrupt my diagram and I cannot find an easy way out. Many thanks!
From: Walter Roberson on 19 May 2010 15:33
Stephan Jaiser wrote: > I am trying to draw a complex stairstep plot, seek some coordinates via > ginput and then superimpose a transparent patch to highlight an area of > interest. It all works well until I set the alpha value on the patch, > which has some detrimental effects on the previously drawn figure and > any subsequent ginput. > I am running Matlab R2009a 64bit on Win 7 but have found similar issues > with Matlab 2007a. > penultimate line. Setting 'facealpha' has several effects: (1) it makes > the patch semi-transparent, as intended (2) there is a subtle (?1 pixel) > movement of the axes and figure elements (3) the stairstep plot suddenly > develops jagged instead of smoothed corners (4) the subsequent ginput > has a haircross cursor which is twice the previous thickness, and the > cursor is noticeably slow to follow mouse movements. For whatever it is worth, I do not see those results when I execute your code on 2008b for Linux (Ubuntu) displaying from a server to a Linux desktop. I see a flash as the plot is redrawn as I set the face alpha, but everything is left in the same place. |