Differentiate nominal and ordinal stroke dash encoding
See original GitHub issueGood to see the new strokeDash
channel encoding. Quite reasonably, encoding for anything other than nominal or ordinal data generates a warning. But I wonder if it would be possible to make the default nominal stroke dash sequence less ordered (i.e. alternating higher ink dashes with lower ink ones). And then for ordinal encoding, contrast this with a clearly ordered sequence from high ink to low ink.
Here is the default sequence, which is currently the same for nominal and ordinal data encoding:
Any change in defaults could also take the opportunity to have a longer sequence than the 5 current dash styles. Here for example is a set of 10 dash styles with nominal unordered and ordinal in dark to light sequence:
In this example, the nominal sequence is
"strokeDash": {
"field": "cat",
"type": "nominal",
"scale": {
"domain": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"range": [ [1, 0], [5, 4], [2, 4], [8, 4, 4, 4], [1, 3], [16, 4], [6, 4], [8, 4], [4, 6], [10, 4] ]
}
}
and the ordinal sequence:
"strokeDash": {
"field": "cat",
"type": "nominal",
"scale": {
"domain": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"range": [ [1, 0], [16, 4], [10, 4], [8, 4], [8, 4, 4, 4], [6, 4], [5, 4], [4, 6], [2, 4], [1, 3] ]
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
I take your point about fluctuating lines. Appropriate dash sizes are likely to relate to the size of the view and frequency of variation in line position. Perhaps one possibility would be to allow a scaling parameter that could be applied to all dash arrays so that the dash frequency can be matched with the frequency of line variation. So, a dash scale of 0.5 applied to a dash [8,2,3,2] results in [4,1,1.5,1].
Here is an example showing various dash scales for some fluctuating lines all using the ordered sequence of dash styles is mentioned above:
And the code to produce the tests (I’ve applied the scaling externally in elm-vegalite, so the code below just shows the default dash scaling of 1)
Since that uses a point (Vega symbol) shape, it might be just easier to change the default shape to be a longer line symbol. Changing the size would be trickier.