This code should produce diagonal line from [x=0, y=0]
to [x2=1, y2=1]
, but produces empty chart playground:
{
"encoding": {
"x": {
"value": 0,
"type": "quantitative"
},
"x2": {
"value": 1,
"type": "quantitative"
},
"y": {
"value": 0,
"type": "quantitative"
},
"y2": {
"value": 1,
"type": "quantitative"
}
},
"mark": {
"type": "rule"
}
}
I want to set data points explicitly with the value
, not reference it from the data, as the actual plot is more complicated and rule needs to be added separately from the data.
This code should produce diagonal line from [x=0, y=0]
to [x2=1, y2=1]
, but produces empty chart playground:
{
"encoding": {
"x": {
"value": 0,
"type": "quantitative"
},
"x2": {
"value": 1,
"type": "quantitative"
},
"y": {
"value": 0,
"type": "quantitative"
},
"y2": {
"value": 1,
"type": "quantitative"
}
},
"mark": {
"type": "rule"
}
}
I want to set data points explicitly with the value
, not reference it from the data, as the actual plot is more complicated and rule needs to be added separately from the data.
Two changes to make:
"datum"
, not "value"
. I don't fully understand the difference between the two, but I believe datum
is used when there is an existing scale/domain in play (the x- and y-axes), whereas value
is used in the absence of a preexisting scale/domain (e.g. color and shape of points in a plot that doesn't assign them to a channel).{
"encoding": {
"x": {"datum": 0, "type": "quantitative"},
"x2": {"datum": 1, "type": "quantitative"},
"y": {"datum": 0, "type": "quantitative"},
"y2": {"datum": 1, "type": "quantitative"}
},
"mark": {"type": "rule"},
"data": {"values": [{}]}
}