legend bg color?

Hi Jose,

lg = legend()
lg.get_frame().set_fill(False)

works for me. Let me know if this fixes it.

Yours,
Patrick

···

On 9/10/07, Jose Gomez-Dans <jgomezdans@…287…> wrote:

Hi,

On 9/5/07, Patrick Bradley <patrick.bradley@…287…> wrote:

lg = legend()
lg.get_frame().set_facecolor(‘black’)

Does anyone know how to set this background to transparent? I think I

sent a message to the list a few days ago, but I think it never made
it…

Cheers!
Jose

Hi Patrick,

Thanks for your message!

lg = legend()
lg.get_frame().set_fill(False)

Mmmm, this is OK, let's say I wanted a figure with a transparent
background. I can't find a set_fill() method for this class. I have
tried the facecolor attribute, but no luck. I think I got this right.
I am using the Agg backend (does this make a difference?). The files
are RGBA pngs, but the alpha channel is always 255, so my background
is always white, as opposed to transparent.

Am I doing something wrong? I am using matplotlib 0.90.0. Here's some
sample code

import pylab
FaceColor=(1.0, 1.0, 1.0, 0.0 )
fig = pylab.figure(figsize=(6,1.5))
ax = fig.add_axes([0.05, 0.4, 0.9, 0.5])
cmap = mpl.cm.jet
norm = mpl.colors.Normalize(vmin=0, vmax=1)
cb = mpl.colorbar.ColorbarBase(ax, cmap=cmap, \
              norm=norm,orientation='horizontal' )
cb.set_alpha(0.0)
fig.set_facecolor(FaceColor)
pylab.savefig( "fichero.png", dpi=72, facecolor=FaceColor)

cheers!
José

···

On 9/10/07, Patrick Bradley <patrick.bradley@...287...> wrote:

You can turn off the figure frame entirely

  fig = figure(frameon=False)

Or you can leave the frame on, but set the alpha channel

  fig = figure()
  fig.figurePatch.set_alpha(0.1)

Does that help? Note you may want to set the alpha of the axesPatch as well

  ax.axesPatch.set_alpha(0.5)

you can do the same for legends, where l is a Legend instance

  l.legendPatch.set_alpha(0.5)

JDH

···

On 9/11/07, Jose Gomez-Dans <jgomezdans@...287...> wrote:

Hi Patrick,

Thanks for your message!

On 9/10/07, Patrick Bradley <patrick.bradley@...287...> wrote:
> lg = legend()
> lg.get_frame().set_fill(False)

Mmmm, this is OK, let's say I wanted a figure with a transparent
background. I can't find a set_fill() method for this class. I have
tried the facecolor attribute, but no luck. I think I got this right.
I am using the Agg backend (does this make a difference?). The files
are RGBA pngs, but the alpha channel is always 255, so my background
is always white, as opposed to transparent.

Am I doing something wrong? I am using matplotlib 0.90.0. Here's some
sample code