On Thu, Sep 2, 2010 at 2:15 AM, Mitesh Patel <qed...@gmail.com> wrote:

> Hello,
>
> Is it possible to specify both an alpha level and a background color so
> that an entire saved image has a uniform transparency and color?  For
> example, with matplotlib 1.0.0, this script yields the attached image:
>
> from matplotlib.pyplot import figure, savefig, show
>
> fig = figure()
> ax = fig.add_subplot(111)
> ax.plot([1,2,3])
>
> fig.patch.set_alpha(0.5)
> for ax in fig.axes:
>    ax.patch.set_alpha(0.5)
>
> fig.patch.set_facecolor('red')
> for ax in fig.axes:
>    ax.patch.set_facecolor('red')
>
> savefig('test.png', facecolor='red')
>
>
> In particular, the areas inside and outside the axes have different
> transparency level and color.  Perhaps I'm over/mis/ab-using the options
> here?
>
> Thanks for your great software and any help you can provide!
>
> Sincerely,
> Mitesh Patel
>
>
>
Mitesh,

That is an interesting idea.  Theoretically, it might be possible to
implement such a feature.  The key design idea of Matplotlib is to have
Artist objects that own other Artist objects.  So, a Figure owns several
axes, and those axes own various plotting elements, which are all subclasses
of Artists.  So, I could imagine that an rgba value could get "inherited" by
a child artist from its parent (unless the user specifies differently).

Would we want to automatically make text inherit the rgba setting?  Also,
currently there are a lot of places in code where one directly specifies
color, or color is automatically chosen (from a colormap or a rotating set
of colors).  I wonder what should be the proper behavior in those cases
(ignore parent setting? if so, then do the setting still get passed on to
child artists? should the automatically chosen settings get passed on?).

What do others think?

Ben Root
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to