When I plot a patch with transparency < 1 over an image created with imagesc (Matlab R2012a), I get something that looks like lots of "tick lables", or numbers over the image along the axes. The following code reproduces the problem:
imagesc(rand(10,20))
hold on
patch([5 5 15 15],[3 7 7 3],'r','facealpha',.5)
Is this a bug, or is there a way to do it properly?
EDIT
The numbers disappear if I set set(gca,'xtick',[],'ytick',[])
, so it is indeed tick-related. I would of course prefer having ticks on my figure.
This kind of graphical artifact is usually related to the renderer. Particularly the OpenGL renderer seems to mess up on certain combinations of Matlab release, graphics card, and operating system.
The standard workaround is to change the renderer from OpenGL to zBuffer in the figure properties, which is achieved via the command
set(gcf,'renderer','zbuffer')
Unfortunately, OpenGL is the only renderer that supports transparency, so this solution won't work for you.
As a possible alternative workaround, you can switch from hardware to software OpenGL renderer via the command
opengl software
Check the help on opengl to find out how to set this up in case you're in a *nix environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With