Why does legend patch turn black when using saveas?

2 visualizzazioni (ultimi 30 giorni)
Patrik Ek
Patrik Ek il 23 Ott 2014
Modificato: Patrik Ek il 23 Ott 2014
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?
Example code:
function testScript()
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
  1 Commento
Patrik Ek
Patrik Ek il 23 Ott 2014
Modificato: Patrik Ek il 23 Ott 2014
If this is a known bug or is unsupported I would also appreciate a comment or so. In both cases it would be worth sending a bug report on and also add that this is something that would be valuable in future releases. I think that it is a usual that legends become to long or to large.

Accedi per commentare.

Risposte (0)


Scopri di più su Printing and Saving in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by