By default, Plotly hides the line on click on its label in the legend section.
Is there a combination of shift/ctrl/alt/
any other keys to make only the selected line appear and hide all the other lines?
Just double click left mouse button
. If this sounds to easy / good to be true, just try it yourself with this snippet:
Code:
import plotly.express as px
df = px.data.gapminder().query("continent=='Americas'")
fig = px.line(df, x="year", y="lifeExp", color='country')
fig.show()
Plot 1:
Now, if you'd like to look at Haiti only, just hover over the legend, double clik left mouse button
, and this is what you'll get:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With