Altair: Encoding Channel for Line Style

Created on 11 Nov 2016  路  4Comments  路  Source: altair-viz/altair

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

Most helpful comment

If anyone else is led to this issue by a search engine, the strokeDash encoding is available since Altair 4.1. See here.

All 4 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DentonGentry picture DentonGentry  路  3Comments

fischcheng picture fischcheng  路  4Comments

floringogianu picture floringogianu  路  3Comments

morberg picture morberg  路  3Comments

HalukaMB picture HalukaMB  路  3Comments