|
From: <jd...@us...> - 2008-06-25 14:37:31
|
Revision: 5672
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5672&view=rev
Author: jdh2358
Date: 2008-06-25 07:37:23 -0700 (Wed, 25 Jun 2008)
Log Message:
-----------
added transparent figure faq
Modified Paths:
--------------
trunk/matplotlib/doc/faq/howto_faq.rst
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-06-25 12:49:57 UTC (rev 5671)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-06-25 14:37:23 UTC (rev 5672)
@@ -6,7 +6,35 @@
.. contents::
+.. _howto-transparent:
+How do I save transparent figures?
+==================================
+
+The :meth:`~matplotlib.pyplot.savefig` command has a keyword argument
+*transparent* which, if True, will make the figure and axes
+backgrounds transparent when saving, but will not affect the displayed
+image on the screen. If you need finer grained control, eg you do not
+want full transparency or you to affect the screen displayed version
+as well, you can set the alpha properties directly. The figure has a
+:class:`matplotlib.patches.Rectangle` instance called *figurePatch*
+and the axes has a Rectangle instance called *axesPatch*. You can set
+any property on them directly (*facecolor*, *edgecolor*, *linewidth*,
+*linestyle*, *alpha*). Eg::
+
+ fig = plt.figure()
+ fig.figurePatch.set_alpha(0.5)
+ ax = fig.add_subplot(111)
+ ax.axesPatch.set_alpha(0.5)
+
+If you need *all* the figure elements to be transparent, there is
+currently no global alpha setting, but you can set the alpha channel
+on individual elements, eg::
+
+ ax.plot(x, y, alpha=0.5)
+ ax.set_xlabel('volts', alpha=0.5)
+
+
.. _howto-subplots-adjust:
How do I move the edge of my axes area over to make room for my tick labels?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|