无效规范 altair.vegalite.v4.schema.channels.Color,验证 'required' 'type' 是必需的 属性
Invalid specification altair.vegalite.v4.schema.channels.Color, validating 'required' 'type' is a required property
我正在尝试使用十六进制代码更改图表的颜色。这是我的代码
Uniq=["Seattle","New York"]
select = alt.selection_single(
name='Select', # name the selection 'Select'
fields=["location"], # limit selection to the Major_Genre field
init={"location": Uniq[1]}, # use first genre entry as initial value
bind=alt.binding_select(options=Uniq) # bind to a menu of unique genre values
)
alt.Chart(weather).mark_point(filled=True, size=15, opacity=0.5).add_selection(
select).encode(
alt.X(alt.repeat('column'), type='quantitative'),
alt.Y(alt.repeat('row'), type='quantitative'),
#alt.Color(scale=alt.Scale(domain=[0,10,20,30,40,50],range=["#ffffff","#bdd7e7","#6baed6","#3182bd","#08519c"])'#f4a582'),
color= alt.Color(alt.value("#f4a582")),
opacity=alt.condition(select, alt.value(0.75), alt.value(0.05))
).properties(
width=125,
height=125
).repeat(
row=['temp_max', 'precipitation', 'wind'],
column=['wind', 'precipitation', 'temp_max']
)
这是我得到的错误。
Invalid specification altair.vegalite.v4.schema.channels.Color, validating 'required' 'type' is a required property
如何在使用重复时更改颜色。发送
我想你想要的是这个:
color=alt.value("#f4a582")
我正在尝试使用十六进制代码更改图表的颜色。这是我的代码
Uniq=["Seattle","New York"]
select = alt.selection_single(
name='Select', # name the selection 'Select'
fields=["location"], # limit selection to the Major_Genre field
init={"location": Uniq[1]}, # use first genre entry as initial value
bind=alt.binding_select(options=Uniq) # bind to a menu of unique genre values
)
alt.Chart(weather).mark_point(filled=True, size=15, opacity=0.5).add_selection(
select).encode(
alt.X(alt.repeat('column'), type='quantitative'),
alt.Y(alt.repeat('row'), type='quantitative'),
#alt.Color(scale=alt.Scale(domain=[0,10,20,30,40,50],range=["#ffffff","#bdd7e7","#6baed6","#3182bd","#08519c"])'#f4a582'),
color= alt.Color(alt.value("#f4a582")),
opacity=alt.condition(select, alt.value(0.75), alt.value(0.05))
).properties(
width=125,
height=125
).repeat(
row=['temp_max', 'precipitation', 'wind'],
column=['wind', 'precipitation', 'temp_max']
)
这是我得到的错误。
Invalid specification altair.vegalite.v4.schema.channels.Color, validating 'required' 'type' is a required property
如何在使用重复时更改颜色。发送
我想你想要的是这个:
color=alt.value("#f4a582")