Black Lives Matter. Please consider donating to Black Girls Code today.

How to set the legend scrollable to avoid overlapping the plot

Hi,
It would be nice to set the legend scrollable, if there is not enough place to show all legend items.

Here is a jsFiddle-Example for that: https://jsfiddle.net/1n4gx8qb/1/
If I have 28 lines, all looks fine. But If I have 29 lines, the legend will overlaps the plot fully.

It would be nice to tell the legend only show e.g. 4 lines of legend-entries (this are 4x4=16 lines in that example) and if there comes one more line the legend should be scrollable. So the last line will not be shown (and the legend will not overlapping the plot).

Is that possible?

Not at the moment.

We chose to not allow scrolling for horizontal legends.

You’re not the first to ask for more legend layout configuration options. I’d recommend subscribing to https://github.com/plotly/plotly.js/issues/960 for the latest info.

Hi @etienne,

Any update on this? scrolling horizontal legend?

Thanks,
Adnan

2 Likes