Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add framealpha argument for legend #1626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 17, 2013

Conversation

piti118
Copy link
Contributor

@piti118 piti118 commented Dec 28, 2012

Straight from matplotlib recipe. I think frame alpha belongs to keyword argument like

ax.legend(framealpha=0.5)

rather than

leg = ax.legend()
leg.get_frame().set_alpha(0.5)

@dmcdougall
Copy link
Member

Travis failure looks like a dud.

This seems like a simple enough wrapper around .get_frame().set_alpha(). I'd be happy for this to be merged.

Anybody else want to give a +1 or other feedback?

Edit: Barring minor style issues below.

def test_framealpha():
x = np.linspace(1,100,100)
y = x
plt.plot(x,y, label='mylabel', lw=10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a space after the first comma? Like so: plt.plot(x, y, label='mylabel', lw=10).

@mdboom
Copy link
Member

mdboom commented Jan 16, 2013

Seems fine -- perhaps it's a needless proliferation of keyword arguments -- OTOH, I can see why this is a common thing someone would want to do. @pelson: do you want to ring in on this?

@piti118
Copy link
Contributor Author

piti118 commented Jan 16, 2013

Both ways to get transparency doesn't work well with shadow though since shadow option assume full opacity of the legend frame.

@mdboom
Copy link
Member

mdboom commented Jan 16, 2013

Hmmm... should we fix shadow while we're at it, then?

@piti118
Copy link
Contributor Author

piti118 commented Jan 16, 2013

This is what it looks like. It looks funny but I'm not sure what I should expect....
tmp

plot(range(10),range(10),label='hey')
legend(shadow=True).get_frame().set_alpha(0.5)

@pelson
Copy link
Member

pelson commented Jan 17, 2013

@pelson: do you want to ring in on this?

No complaints from me.

@mdboom
Copy link
Member

mdboom commented Jan 17, 2013

I think the shadow issue is probably fine for now... I agree -- it's not clear what it should do instead. @piti118: can you please rebase this on master so we can hit that big green merge button?

@WeatherGod
Copy link
Member

That does look funny to me, but I can understand why some might not think
it is. I have played around a lot with shadowing effects and alphas with
non-white overlays that have taught me otherwise. Try the legend in a
different color, and I think you will see what I mean.

@piti118
Copy link
Contributor Author

piti118 commented Jan 17, 2013

Rebased.. I think I did it right.

@mdboom
Copy link
Member

mdboom commented Jan 17, 2013

Yep. Looks good. Merging.

mdboom added a commit that referenced this pull request Jan 17, 2013
Add framealpha argument for legend
@mdboom mdboom merged commit a53a6f7 into matplotlib:master Jan 17, 2013
@piti118
Copy link
Contributor Author

piti118 commented Jan 17, 2013

Hmmm... I think I didn't write the change log...

piti118 added a commit to piti118/matplotlib that referenced this pull request Jan 17, 2013
@mdboom
Copy link
Member

mdboom commented Jan 17, 2013

Oh, thanks. I should have noticed it before merging. I should be able to merge that manually. No worries.

@piti118
Copy link
Contributor Author

piti118 commented Jan 17, 2013

just pull #1677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants