[Matplotlib-users] facecolor for legend with alpha and shadow

Slavin, Jonathan jslavin at cfa.harvard.edu
Tue May 15 14:23:15 EDT 2018


Ah, yes that makes sense.  Though I would still say that the intention of
having the shadow is to have at the edges and the method of using the
polygon in that way is a simple method to get it.  Unfortunately the side
effect of that is to cause that graying of the face of the legend when
transparency is used.  Seems like it would not be an easy fix.

Jon

On Tue, May 15, 2018 at 1:29 PM, Paul Hobson <pmhobson at gmail.com> wrote:

> Jon,
>
> I think with the transparent legend face, you're seeing the dark shadow
> underneath it. This seems to be reflected when changing the alpha
> values.The shadow itself if is a polygon the same size of the legend,
> z-ordered below the legend itself, and offset slightly.
>
> Does that explain this to you?
> -Paul
>
> On Tue, May 15, 2018 at 7:07 AM, Slavin, Jonathan <jslavin at cfa.harvard.edu
> > wrote:
>
>> Hi all,
>>
>> I'm wondering why using shadow=True causes shading of the legend box when
>> framealpha is set to a number.  That is, if I do:
>> fig,ax = plt.subplots()
>> ax.plot(x,y1,label='y1')
>> ax.plot(x,y2,label='y2')
>> ax.legend(framealpha=0.5,shadow=True)
>>
>> The face color of the legend is gray.  There doesn't seem to be any
>> reason for this, so I'm assuming it's a bug.  I've been looking through the
>> docs and haven't found anything relevant - and haven't found any way around
>> it other than turning off the shadow. Any help would be appreciated.
>>
>> Regards,
>> Jon
>>
>> --
>> ________________________________________________________
>> Jonathan D. Slavin                 Harvard-Smithsonian CfA
>> jslavin at cfa.harvard.edu       60 Garden Street, MS 83
>> phone: (617) 496-7981       Cambridge, MA 02138-1516
>> cell: (781) 363-0035             USA
>> ________________________________________________________
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users at python.org
>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>
>>
>


-- 
________________________________________________________
Jonathan D. Slavin                 Harvard-Smithsonian CfA
jslavin at cfa.harvard.edu       60 Garden Street, MS 83
phone: (617) 496-7981       Cambridge, MA 02138-1516
cell: (781) 363-0035             USA
________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180515/0efbc33f/attachment.html>


More information about the Matplotlib-users mailing list