Here's my data:
import plotly.graph_objects as go
import pandas as pd
data = {'vocab':['today', 'started', 'half', 'slowly', "probably", "took", "two", "daily", "change", "life",
"effect", "wrong", "talk", "hard"],
'x':[-12.9, -23.4, -7.1, -6.3, -20.5, -5.8, -32.6, -8.3, -4.2, -12.3, -9.6, -4.2, - 20.4, - 15.7],
'y':[21.6, 21.8, 33.2, 22.7, 34, 0.4, 22.4, 31.9, 17.9, 20.13, 25.7, 22.3, 26.8, 19.2],
'freq':[277, 491, 264, 138, 250, 279, 753, 93, 77, 113, 425, 122, 326, 345]}
df = pd.DataFrame(data)
fig = go.Figure()
config = dict({'scrollZoom': True})
fig.add_trace(go.Scatter(x = df.x, y = df.y,
mode = "markers + text",
text = df['vocab'],
marker = dict(
size = df['freq'],
sizemode = 'area',
sizeref=2.*max(df['freq'])/(295.**2))))
fig.update_layout(title = "help",
hovermode='closest',
yaxis=dict(zeroline=False, showgrid=False),
xaxis=dict(zeroline=False, showgrid=False),
showlegend = False,
width = 1000,
height = 800,
template = "presentation")
fig.show(config=config)
Is there a way to build a custom slider that, as you slide it, filters the bubbles based on the "freq" variable?
I'm assuming it would work best by percentile, but just for simplicity, let's say the slider was set at the value 100, that would filter out all "freq" less than 100, only showing the bubbles with a "freq" greater than 100. I haven't seen Plotly sliders used this way, so I'm not sure how to build this.