Skip to content
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

Configurable width of the symbol area of legends #5212

Merged
merged 2 commits into from
Nov 4, 2020

Conversation

s417-lama
Copy link
Contributor

Problem

It was hard to distinguish different line types (dash or dashdot) in legends because the width of legend items were small.

Scatter plot of dash and dashdot lines:
plotly_dash_before

What I did

I added legend.itemwidth option to configure the width of legend items.

By setting legend.itemwidth = 60:
plotly_dash_after

The option name itemwidth might be controversial; for example, in matplotlib, the corresponding option name is handlelength.

@archmoj
Copy link
Contributor

archmoj commented Oct 14, 2020

Thanks for the PR. Looking good to me at first glance.
In respect to adding this new attribute to the API, let me request a review from @nicolaskruchten and @alexcjohnson.

@archmoj
Copy link
Contributor

archmoj commented Nov 3, 2020

@s417-lama we are planning next plotly.js minor (possibly next week) to include new features like this one.
Do you have time to address the remaining comments, so that we could include this feature?

@s417-lama
Copy link
Contributor Author

@archmoj Thank you for reviewing. That sounds nice!
I addressed all of the above comments in 1977f12.

@archmoj
Copy link
Contributor

archmoj commented Nov 4, 2020

@archmoj Thank you for reviewing. That sounds nice!
I addressed all of the above comments in 1977f12.

@s417-lama
Thanks for the quick improvement.
Nicely done!
💃

@archmoj archmoj merged commit ff0b32e into plotly:master Nov 4, 2020
@karolpiczak
Copy link

@archmoj

Is there some architectural reason why itemwidth must be at least 30? In some of the plots I would like to have shorter handles, I don't see an easy way to override this without manually creating a legend using manual annotations.

@bklingen
Copy link

@archmoj

Following up on this, why is itemwidth restricted to be at least 30. I would love to create legends using e.g., itemwidth: 20 in layout.legend.

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

Successfully merging this pull request may close these issues.

None yet

4 participants