-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Feature-Request] Add xshift/yshift to legend #3151
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
Comments
Makes sense, probably a fairly easy add. Feel like making a PR?? 😁 |
@alexcjohnson If cargo-culting away at the commit which added annotation xshift/yshift will do, I might take a shot in about 3-4 weeks. But I bet my code wouldn't be up to snuff regarding best practices :D |
So |
@etpinard correct |
@alexcjohnson Would I have to create tests as well? |
Someone would 😏 Most likely just an image test or two would suffice, and we can help, particularly if you can provide a figure JSON ( |
As we're at it anyway: Would it be too hard to also include something like Use-case: You set filtered legends invisible when downloading the PNG and if you have a lot of legend items in An alternative way would be to somehow access something like EDIT: I currently have a legend with an approximate height of 160px due to a lot of |
So basically I found a workaround for my use-case by checking out
EDIT: Being able to predict the top margin of the legend (EDIT2: By positioning through yshift instead of adjusting the |
I think this would also address #1594, at least partially. It'll still probably require manually increasing the margin and then applying the shift to the legend, but at least it would provide some options for dealing with legend/axis overlaps. |
Just a quick question/addition: Is it possible to xshift/yshift shapes? And if not: could we also add this? 😹 EDIT: To give a use-case: I want to display a horizontal line (shape line with width: 1 and y0=y1 and x0: 0 and x1: 0.9 with xref: "paper") and have an annotation at the end of it (x: 0.9 y: y0 and align: "left"). With fixed plot sizes that's not a problem but when you are able to achieve responsiveness you have vastly different results when using paper as ref due to variable plot width. I guess I'll have to try and use x as xref instead now :D. EDIT2: Actually xref: "x" doesn't help... the bars in my plot have varying width to which the annotation text size isn't adapting resulting in almost the same problem 😹 |
Hello everyone, is there any progress on this? 😸 |
EDIT: Nevermind, I had a bug in my margin calculation. Fixed it ^^. |
This issue has been tagged with A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort. Sponsorship range: $5k-$10k What Sponsorship includes:
Please include the link to this issue when contacting us to discuss. |
Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson |
Hello everyone!
I'd wish for the legend to have xshift and yshift attributes, so I could position it more easily where I want it to be.
Currently I solved most of my positioning problems by using xshift/yshift with annotations and shapes but for some elements (for example "hacked" x axis titles via annotations) that are above where I want the legend to be I have huge problems of positioning for responsive layouts. (Especially with differing heights of the plot div when altering it for narrow displays.)
I can't tell how much work it would mean to implement this for the legend, but since other objects do have these attributes I hope it wouldn't create too much work. It would have an immense impact on how I could layout responsively, though, and would fix a myriad of problems that I have with layouting.
The text was updated successfully, but these errors were encountered: