Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
transparent background for matlab figure

Subject: transparent background for matlab figure

From: Jeho Shephat

Date: 6 Feb, 2007 18:42:03

Message: 1 of 7

What is the command to save my matlab figure with a
transparent(instead of white) background? Is this even possible?

Subject: transparent background for matlab figure

From: Jerome

Date: 7 Feb, 2007 03:45:00

Message: 2 of 7

Hi,

you can set an alpha parameter when you save image with IMWRITE in PNG
format.

help imwrite
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/imwrite.html

Jérôme

Subject: transparent background for matlab figure

From: awer awer

Date: 18 Jan, 2009 04:22:02

Message: 3 of 7

"Jeho Shephat" <seth_shumate@hotmail.com> wrote in message <ef4d1d8.-1@webcrossing.raydaftYaTP>...
> What is the command to save my matlab figure with a
> transparent(instead of white) background? Is this even possible?

You can remove (or change) the bg color in the following way:
set(gca,'color','none')

Subject: transparent background for matlab figure

From: Bruno Luong

Date: 18 Jan, 2009 07:54:05

Message: 4 of 7

"Jeho Shephat" <seth_shumate@hotmail.com> wrote in message <ef4d1d8.-1@webcrossing.raydaftYaTP>...
> What is the command to save my matlab figure with a
> transparent(instead of white) background? Is this even possible?

Go to "Edit -> Copy Options" menu, lake sure "Transparent background" is checked.

Copy the graphic "Edit Copy". The Transparent Image is in your clipboard. You can copy/past in your favorite software, and save it.

Bruno

Subject: transparent background for matlab figure

From: Oliver Woodford

Date: 26 Jan, 2009 23:26:02

Message: 5 of 7

"Jeho Shephat" wrote:
> What is the command to save my matlab figure with a
> transparent(instead of white) background? Is this even possible?

My print2im function now supports transparent backgrounds when saving to png, with the added benefit of anti-aliased graphics:
http://www.mathworks.com/matlabcentral/fileexchange/22093
E.g.
>> peaks
>> print2im test.png -alpha

Subject: transparent background for matlab figure

From: Oliver Woodford

Date: 24 Apr, 2009 14:32:02

Message: 6 of 7

"Jeho Shephat" wrote:
> What is the command to save my matlab figure with a
> transparent(instead of white) background? Is this even possible?

Set the 'color' property of the figure (and axes if you want) to 'none', then export the figure to the desired format using export_fig:
http://www.mathworks.com/matlabcentral/fileexchange/23629

A transparent background can be reproduced in pdf, eps and png formats.

Transparent patch objects and images are only correctly rendered when exporting to bitmap formats (as the painters algorithm used for generating vector format files does not support semi-transparent objects), and the only bitmap format to support transparency in the output image is png, i.e. exporting to png is the only way to maintain the transparency of objects in the output (when using export_fig), should you want this.

Subject: transparent background for matlab figure

From: Jeremy

Date: 21 Mar, 2013 23:29:20

Message: 7 of 7

I got command line export via print to a emf vector file to respect the transparent background by switching the renderer:

print(gcf,'transparent.emf','-dmeta','-painters');

Very useful for exporting large batches of vector based figures into PowerPoint via the Insert Photo Album (for different slides) or Insert Picture (same slide)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us