Got Questions? Get Answers.
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:
printing unwanted black background

Subject: printing unwanted black background

From: Sasan

Date: 29 Oct, 2011 03:37:15

Message: 1 of 4

Whenever I try to print a figure the output (jpeg, png) always has a black background, even when I set a white or clear background. My figures utilize the pcolor, surf, and/or slice functions. If anyone has encountered such issues and has found a solution, please share.

Subject: printing unwanted black background

From: Pavelo

Date: 20 Jul, 2012 14:09:20

Message: 2 of 4

"Sasan " <markjohnson@yahoo.com> wrote in message <j8fsdb$qo5$1@newscl01ah.mathworks.com>...
> Whenever I try to print a figure the output (jpeg, png) always has a black background, even when I set a white or clear background. My figures utilize the pcolor, surf, and/or slice functions. If anyone has encountered such issues and has found a solution, please share.

I'm having the same problem, and this unanswered question is the only mention of anyone else having it that i found. I'm sort of starting to think that this could be a rare bug.

At any rate, i have the same problem. I'm trying to save a surf plot and it comes out with black background, which also makes all the axis labels unreadable. I have tried various file formats. I have tried print and saveas commands. I have tried setting different background colors and turning inverthardcopy off and on. All to no avail.

If anyone had encountered something like this and had successfully fixed it, your help would be most appreciated.

Subject: printing unwanted black background

From: Pavelo

Date: 20 Jul, 2012 18:43:13

Message: 3 of 4

"Pavelo" wrote in message <juboqg$ca7$1@newscl01ah.mathworks.com>...
> "Sasan " <markjohnson@yahoo.com> wrote in message <j8fsdb$qo5$1@newscl01ah.mathworks.com>...
> > Whenever I try to print a figure the output (jpeg, png) always has a black background, even when I set a white or clear background. My figures utilize the pcolor, surf, and/or slice functions. If anyone has encountered such issues and has found a solution, please share.
>


So i played around a bit and here's what i figured out:

I get black background (that can't be corrected in an way that i've tried) when i save a pcolor, mesh, or surf image that has interpolated shading (shading interp). There is no problem for flat or faceted shading.

No idea why this is happening of if there is a way to fix it, but there you have it.

Subject: printing unwanted black background

From: Pavelo

Date: 20 Jul, 2012 20:53:17

Message: 4 of 4

So the above "solution" comes and goes: even with other shading setting it sometimes inexplicably saves the image with a black background. Interestingly enough, it seems to change depending on which 2D array i plot using surf. So i'm stumped. Seems very much like a bug, but i think i found a work around.

If you go to the image's "Copy Options" and in the "Figure Background Color" you select "Use Figure Color" then it seems to keep the color that you set yourself (default = grey).

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