facecolor and edgecolor

I'm not understanding facecolor and edgecolor.
In the code below (on Windows, with TkAgg)
I get the facecolor displayed but not the
edgecolor, and the saved figure shows *neither*.
Why? (version is 0.98.1)

Thanks,
Alan Isaac

import matplotlib.pyplot as plt
import numpy as np

fig1 = plt.figure(1)
fig1.set_frameon(True)
fig1.set_facecolor('r')
fig1.set_edgecolor('b')

ax1 = fig1.gca()
ax1.plot([1,2,3])

fig1.savefig('c:/temp/temp.eps')

plt.show()

Alan G Isaac wrote:

I'm not understanding facecolor and edgecolor.
In the code below (on Windows, with TkAgg)
I get the facecolor displayed but not the
edgecolor, and the saved figure shows *neither*.
Why? (version is 0.98.1)

It looks to me like a bug plus a feature. The bug is that in the screen display, the edgecolor can get lost, presumably clipped. On my system (linux, gtkagg) the edgecolor is visible only along the top.

The feature is that by design, the figure edgecolor and facecolor have to be specified separately for saving versus screen display. This prevents the screen default grey background from being printed. Maybe there needs to be a savefig option, possibly set via rcParams, to defeat this behavior and simply use the screen settings. At present, you can set the savefig colors in rcParams or via savefig kwargs. Is this adequate?

Eric

···

Thanks,
Alan Isaac

import matplotlib.pyplot as plt
import numpy as np

fig1 = plt.figure(1)
fig1.set_frameon(True)
fig1.set_facecolor('r')
fig1.set_edgecolor('b')

ax1 = fig1.gca()
ax1.plot([1,2,3])

fig1.savefig('c:/temp/temp.eps')

plt.show()

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Alan G Isaac wrote:

I'm not understanding facecolor and edgecolor. In the code below (on Windows, with TkAgg)
I get the facecolor displayed [onscreen] but not the edgecolor, and the saved figure shows *neither*. Why? (version is 0.98.1)

It looks to me like a bug plus a feature. The bug is that in the screen display, the edgecolor can get lost, presumably clipped. On my system (linux, gtkagg) the edgecolor is visible only along the top.

The feature is that by design, the figure edgecolor and facecolor have to be specified separately for saving versus screen display. This prevents the screen default grey background from being printed. Maybe there needs to be a savefig option, possibly set via rcParams, to defeat this behavior and simply use the screen settings. At present, you can set the savefig colors in rcParams or via savefig kwargs. Is this adequate?

OK, we agree that edge color can be lost in onscreen
display, apparently a bug in figure clipping.

Now for the "feature".

I did notice that savefig takes keyword args allowing
us to set facecolor and edgecolor. I would call this
"adequate" in some sense, but it is confusing. It is too
implicit; I was not able to easily determine why may
changes to the **figure** did not affect the file. (Note
that I may not even view an onscreen display for some figures.)

So I do not think it is a problem that the screen display
and savefig have different defaults, presumably invoked but
a default of None. But if the user sets the figure values,
this should override the defaults (in both cases).
Does that seem right?

Thank you,
Alan

···

On 5/5/2009 2:48 PM Eric Firing apparently wrote: