Hi,
It would be great to be able to encode data by the line style (e.g. solid/dashed lines) similar to the shape encoding for point marks.
Have I just overseen that this is already possible with altair?
And if not, would it be possible to implement this?
What i have in mind is something like this:
data = DataFrame({'x': [1,2,1,2], 'y': [0, 1, 1, 0], 'A': ['a', 'a', 'b', 'b']})
Chart(data).mark_line().encode(
x='x', y='y',
style='A'
)
Which would produce a plot with two lines one solid, one dashed and corresponding legend.
Niels
I don't think that encoding by line-style is supported in Vega-Lite, so that's not currently possible in Altair.
It looks like there's an open issue in Vega-Lite discussing additional encoding channels: https://github.com/vega/vega-lite/issues/1278
Thanks the reply and for the hint! Let's see what I can achieve over there.
If anyone else is led to this issue by a search engine, the strokeDash encoding is available since Altair 4.1. See here.
Most helpful comment
If anyone else is led to this issue by a search engine, the
strokeDashencoding is available since Altair 4.1. See here.