Why does legend patch turn black when using saveas?
2 views (last 30 days)
Hi, I have a problem with the function saveas in matlab. The problem appears when I create a legend for more than one graph (eg 2 line graphs) in an image and then uses saveas on the figure. The problem is that when I try to use saveas (or publish, which uses saveas) on the image and the legend patch (the object named rectangle) is set to white, the patch turns black in the image (for me a .png image).
Since I wanted to set the background of the legend object to semi-transparent I had to remove the box and this causes some problems. The details will be seen in the example code. I am not sure whether there is a problem for all types of images, but I know it is at least a problem for .png images.
Have anyone seen this problem before and is it a known fix or workaround for it?
function setLegendAlpha( alphaValue )
I am not sure if this problem is due to some error in the code in the function setLegendAlpha or if it is a bug. Also, if someone knows a workaround that does not cause the legend background to turn black when saving with saveas I would be happy. I can add that this problem cannot be seen in the figure and if I save it using file->save this problem is not seen either.
Matlab 2014a, windows 7