Transparency of rectangle disappears when saving as fig?

5 views (last 30 days)
I can't figure this one out from past posts:
I add a transparent rectangle (alpha=0.3) to my plot:
rectangle('Position',[135 0 30 0.2], 'FaceColor', [0.2000 0.8000 0 0.3])
Then I want to save as a .fig file for later data processing:
set(gcf,'units','normalized','outerposition',[0 0 1 1])
savefig([root_dir,subnum,'/03_TMS/04_EMG_SPs/03_Plots_Tables/Individual_Graphs/',trialName,'_stim',num2str(j),'.fig']);
However, savefig gets rid of my transparency. The examples I could find discussed how to deal with this when you want to keep a transparent background / save as a .png image. How can I save as a .fig file and keep my transparency?
  2 Comments
Jan
Jan on 19 Jul 2019
Currently you showed only, how you save the file. A file does not contain transparent objects, but they appear transparently, when you open the file and create a new figure. So please add the code you use to open the figure. Does it set the renderer to painters implicitly? You need OpenGL for transparency.
Kathleen Hupfeld
Kathleen Hupfeld on 20 Jul 2019
Ah ok all good things to know, thank you for your input!! I was just using GUI to open the .fig files (i.e., file->open).
I ended up working around the problem by just making a lighter green rectangle first, then plotting the EMG signal I'm working with over top of that rectangle, so it doesn't matter that it won't reopen as transparent.

Sign in to comment.

Answers (0)

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!