Transparency in Matlab R2016b

1 view (last 30 days)
oliver
oliver on 5 Nov 2018
Edited: oliver on 6 Nov 2018
I am on R2016b and cannot create PNGs with transparent background. I
  • have set figure background color to "transparent" in copy options and tried copy-pasting -> white background
  • same after doing set(gca/gcf,'color','none') -> results in a black bg in Matlab and in a white bg when pasted.
  • edited figure properties and changed figure color to HSV with 100% transparency -> white background
Is there any way to get transparency in Matlab?
  1 Comment
oliver
oliver on 6 Nov 2018
the only way I managed so far is so print to epsc2, then open in Illustrator to remove the white rectangle which is the figure background, and export to PNG. But surely Matlab can handle this without needing an expensive 3rd party software or without me having to manually edit the eps file.

Sign in to comment.

Answers (1)

madhan ravi
madhan ravi on 5 Nov 2018
Edited: madhan ravi on 6 Nov 2018
  2 Comments
oliver
oliver on 6 Nov 2018
Edited: oliver on 6 Nov 2018
Thanks but I may need a little more than that. Do you mean
set(gcf,'alpha',0)
I tried this and get a white background (both with copy/paste and print to png command).
If I just do alpha(0.5) the transparency of the facecolor in my plot elements is changed but the background is still white, so no good.
oliver
oliver on 6 Nov 2018
Edited: oliver on 6 Nov 2018
You have just changed you answer from "alpha" to a link. This will make it very difficult for others to follow this exchange. If you want to paste a new answer, better do so in the form field below.
With respect to your new answer, I find it odd that a multi-$1000 software is incapable of producing a PNG with transparent background and asks users to manually edit EPS files or install a user contributed fix (as suggested in your link). If this is the only solution, why then do they have the "transparent background" in the figure copy options. Seems like a bug to me which has persisted through numerous releases now without being fixed.

Sign in to comment.

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!