是否可以在Altair中实现数据分类方案(对于唱片图)?
我正在使用Altair创建一个Choropleth情节功能,并希望使用不同的数据“ nofollow noreferrer”>“分类”方案对于散点标记的大小。我已经查找了 bin参数
和 bin transform
在编码
中,但尚未解决。理想情况下,我想像它们在 size 部分是相关的)
base = alt.Chart(choro_data).mark_geoshape(
fill="lightgray",
stroke='white',
strokeWidth=0.1
).properties(
width=1000,
height=800,
title='Safe Graph for Average Distance'
).project(
type='albersUsa'
)
cold = alt.Chart(choro_data).mark_circle().encode(
latitude='properties.latitude:Q',
longitude='properties.longitude:Q',
stroke=alt.ColorValue("black"),
strokeWidth = alt.value(1),
strokeOpacity = alt.condition(
'datum.properties.recency <= 5', ### condition value set to??
alt.value(1),
alt.value(0)),
color=alt.Color('properties.recency:Q',
bin = alt.Bin(step=5),
scale=alt.Scale(scheme='blues'),
legend=alt.Legend(title='Week Numbers (Cold Spots)')),
size=alt.Size('properties.total:Q',
scale=alt.Scale(range=[0, 70]),
bin=alt.Bin(step=5),
legend=alt.Legend(title='Number of Time Classified as Cold/Hot Spots')),
tooltip=display
)
base+cold
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论