Altair 中的顶层图表标记可以完全覆盖下层图表标记吗?
Can top layer chart marks totally cover lower layer chart marks in Altair?
我想要一个使用 Altair 的杠铃式图表。有没有办法完全隐藏“铃铛”后面的“酒吧”?即使铃铛层在最上面,铃铛下的条也可见。
df = pd.DataFrame({'Category': ['Foo', 'Foo','Bar','Bar'],'Value':[10, 50, 20, 70], 'Start': [10, 10, 20, 20],'Stop': [50, 50, 70, 70], 'Level':['One','Two','One','Two']})
dot = alt.Chart(df).mark_circle(size=200,color='red').encode(
x=alt.X('Value:Q',axis=alt.Axis(grid=True)),
y=alt.Y('Category:N',axis=alt.Axis(grid=False)))
line = alt.Chart(df).mark_rule(color='gray',size=3).encode(
alt.X('Start:Q'),alt.X2('Stop:Q'),
y=alt.Y('Category:N'))
line+dot
您可以尝试将不透明度设置为 1
dot = alt.Chart(df).mark_circle(size=200,color='red', opacity=1).encode(
我想要一个使用 Altair 的杠铃式图表。有没有办法完全隐藏“铃铛”后面的“酒吧”?即使铃铛层在最上面,铃铛下的条也可见。
df = pd.DataFrame({'Category': ['Foo', 'Foo','Bar','Bar'],'Value':[10, 50, 20, 70], 'Start': [10, 10, 20, 20],'Stop': [50, 50, 70, 70], 'Level':['One','Two','One','Two']})
dot = alt.Chart(df).mark_circle(size=200,color='red').encode(
x=alt.X('Value:Q',axis=alt.Axis(grid=True)),
y=alt.Y('Category:N',axis=alt.Axis(grid=False)))
line = alt.Chart(df).mark_rule(color='gray',size=3).encode(
alt.X('Start:Q'),alt.X2('Stop:Q'),
y=alt.Y('Category:N'))
line+dot
您可以尝试将不透明度设置为 1
dot = alt.Chart(df).mark_circle(size=200,color='red', opacity=1).encode(