How to make figures transparent by default, leave foreground color to pdflatex?

Anand Patil <anand@...1465...> writes:

- How can I make my figures and axes transparent by default?

Here's one idea:


In [1]:fig=figure(frameon=False)

In [2]:ax = fig.add_subplot(111, frameon=False)

In [3]:ax.plot([3,1,4,1,5,9,2])
Out[3]:[<matplotlib.lines.Line2D instance at 0x2c98b70>]

In [4]:show()

In [5]:savefig('foo.pdf')

And here's another:

In [20]:fig=figure()

In [21]:fig.figurePatch.set_alpha(0.1)

In [22]:ax=fig.add_subplot(111)

In [23]:ax.axesPatch.set_alpha(0.1)

In [24]:ax.plot([3,1,4,1,5,9,2])
Out[24]:[<matplotlib.lines.Line2D instance at 0x16f7e490>]

In [25]:show()

In [26]:savefig('foo.pdf')

Does either of these do what you are looking for?

- When I inserted some of my old pdf plots into a latex presentation, to
my surprise their foreground color had changed from black to the color
of the text in the presentation. Is there a way to signal to Matplotlib
that I would like this to happen? Can I make this behavior default?

Were the old pdf plots produced with the pdf backend, or with the eps
backend and then converted to pdf with some external utility?

I'm guessing that what happened was that the pdf file didn't specify
any color, and when it was included, it inherited the graphics state
from the including pdf file. I'm not quite sure if that's supposed to
happen when including files, although I can of course see how it could
be considered a useful feature.

Certainly there is no such intended feature in matplotlib. I think I
could support it for monochromatic plots quite easily, but it would be
much trickier if you want part of the plot in the inherited color and
another part in a specified color.

Jouni K. Sepp�nen