Python 使牵牛星散点图指定不同的颜色,而不是相同颜色的阴影
我想从altair复制此图像,该图像由示例中的以下代码生成:Python 使牵牛星散点图指定不同的颜色,而不是相同颜色的阴影,python,google-colaboratory,altair,Python,Google Colaboratory,Altair,我想从altair复制此图像,该图像由示例中的以下代码生成: alt.Chart(source).mark_circle(size=60).encode( x='Vth', y='mob', color='Thickness', tooltip=['Temperature', 'Thickness'] ).interactive()e source = Table_3 但是,我对颜色的数据集选择是数字: 这是我的代码: source = Table_3 alt.Chart(source)
alt.Chart(source).mark_circle(size=60).encode(
x='Vth',
y='mob',
color='Thickness',
tooltip=['Temperature', 'Thickness']
).interactive()e
source = Table_3
但是,我对颜色的数据集选择是数字:
这是我的代码:
source = Table_3
alt.Chart(source).mark_circle(size=60).encode(
x='Vth',
y='mob',
color='Thickness',
tooltip=['Temperature', 'Thickness']
).interactive()
这使得牵牛星给了我相同颜色的阴影。我希望它像示例中那样进行分割:
通过在“厚度”字段中添加
:N
,您可以告诉Altair该数字实际上是名义上的,而不是定量的
alt.Chart(source).mark_circle(size=60).encode(
x='Vth',
y='mob',
color='Thickness:N',
tooltip=['Temperature', 'Thickness']
).interactive()