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)…


Like this ?


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:


thank you so much for your help and time…