-
Notifications
You must be signed in to change notification settings - Fork 185
Allow stroke-dasharray to be a channel? #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is already a strokeDasharray option. See this example: It could be made a channel I suppose, but in practice I think it is usually better to have two marks. |
Here's a common use-case where the user would want the constant to be a channel (cc @espinielli):
|
I had the same case with textAnchor here and used two marks after trying one and learning that it wasn’t a channel. |
I ran into this issue earlier this week in this notebook with two lines that were the same type of data, but one is a "current" system and one is a "proposed" system. I did accomplish this using two marks for each set of data, Plot.line(scenarios, {
filter: d => d.system === 'proposed',
stroke: PROFIT_COLOR,
y: 'bidaProfit',
x: 'attendees',
fx: 'musicians',
strokeWidth: 3,
}),
Plot.line(scenarios, {
filter: d => d.system === 'current',
stroke: PROFIT_COLOR,
y: 'bidaProfit',
x: 'attendees',
fx: 'musicians',
strokeWidth: 3,
strokeDasharray: '2 10',
}), but I think it would have been more elegant if I had been able to use one: Plot.line(scenarios, {
stroke: PROFIT_COLOR,
y: 'bidaProfit',
x: 'attendees',
fx: 'musicians',
strokeWidth: 3,
strokeDasharray: d => d.system === 'current' ? '2 10' : null
}) |
Similar to the
vl.strokedash()
channel in vega-lite, this channel could be used to display, for example, estimated values as dotted lines, i.e. depending on an indicator column in the dataset:Note: a
stroke-width
channel would also prove useful...PS: Plot is a great library, very intellectually stimulating, and the 21 beautifully written articles in the https://observablehq.com/collection/@observablehq/plot collection should be read by all data scientists!
The text was updated successfully, but these errors were encountered: