【发布时间】:2019-09-11 15:30:02
【问题描述】:
我一直在尝试在 jupyter lab 上使用 Altair 制作一些交互式情节。
如您所见,该行在突出显示时不会弹出到前面。如何让它流行到最前面?
附上代码。
import altair as alt
source = df
selection = alt.selection_multi(fields=['class'], on='click')
color = alt.condition(selection,
alt.Color('class:O', legend=None,
scale=alt.Scale(scheme='category10')),
alt.value('lightgray'))
base = alt.Chart(source).mark_line(point=True, size=10).encode(
x='x',
y='y',
color=color
).properties(
width=800,
height=900
).interactive()
legend = alt.Chart(source).mark_point(filled=True, size=200).encode(
y=alt.Y('class:O'),
color=color
).add_selection(
selection
)
base | legend
【问题讨论】:
标签: python-3.x jupyter-notebook line-plot altair