Reputation: 1168
I want to replicate this image from altair generated with this code from the examples:
alt.Chart(source).mark_circle(size=60).encode(
x='Vth',
y='mob',
color='Thickness',
tooltip=['Temperature', 'Thickness']
).interactive()e
source = Table_3
However my dataset choice for colour is numerical: Table_3.head()
this is the code i Have:
source = Table_3
alt.Chart(source).mark_circle(size=60).encode(
x='Vth',
y='mob',
color='Thickness',
tooltip=['Temperature', 'Thickness']
).interactive()
This causes altair to give me shades of the same colour. i want it to divide it like in the example:
Upvotes: 1
Views: 71
Reputation: 892
You can tell Altair that the number is in fact nominal, not quantitative by adding :N
to your "Thickness" field.
alt.Chart(source).mark_circle(size=60).encode(
x='Vth',
y='mob',
color='Thickness:N',
tooltip=['Temperature', 'Thickness']
).interactive()
Upvotes: 1