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

How to automatically hide trace legend?

I have 3 traces, one of them has x and y values has zero (x:[0],y:[0]), this trace is not shown in the chart but it legend shows dark black.

If a trace has zero as values, I need to automatically isolate the legend, (show light black this legend)…

1 Like

Like this https://plot.ly/javascript/reference/#scatter-showlegend ?

This is how my chart looks right now.

And, I need it to look like this automatically when the charts is display.

Is this functionality available for plotly?

that’s showlegend: 'legendonly'

Nop, it didn´t work.

Ok, would you mind sharing a code snippet of what you’ve tried to help me help you?

this is my example,

I had 4 traces, the number 3 has values X and Y zero… as you can see trace3 has a point it on coordinates 0,0, its empty so i want to make that plotly shows this trace automatically like this:

image

thank you so much for your help and time…

A bit late to answer, but I also needed this functionality.
There IS a way to add a trace to a chart, but have it be hidden on startup:

Add the key: visible: 'legendonly'. (Pay attention that the key is not showlegend, but visible.

1 Like