Closed domoritz closed 5 years ago
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"url": "data/movies.json"},
"vconcat": [{
"mark": "bar",
"height": 100,
"encoding": {
"x": {
"bin": true,
"field": "IMDB_Rating",
"type": "quantitative",
"axis": null
},
"y": {
"aggregate": "count",
"type": "quantitative"
}
}
}, {
"hconcat": [{
"mark": "rect",
"encoding": {
"x": {
"bin": true,
"field": "IMDB_Rating",
"type": "quantitative"
},
"y": {
"bin": true,
"field": "Rotten_Tomatoes_Rating",
"type": "quantitative"
},
"color": {
"aggregate": "count",
"type": "quantitative"
}
}
}, {
"mark": "bar",
"width": 100,
"encoding": {
"y": {
"bin": true,
"field": "Rotten_Tomatoes_Rating",
"type": "quantitative",
"axis": null
},
"x": {
"aggregate": "count",
"type": "quantitative"
}
}
}]
}],
"config": {
"range": {
"heatmap": {
"scheme": "greenblue"
}
},
"view": {
"stroke": "transparent"
}
}
}
This works pretty well. I wonder whether we should support customization of the layout in hconcat and vconcat so that we can remove the padding. hconcat
could have a layout
property or all layout properties could be top-level properties of the concat. Thoughts @kanitw?
I think someone need to prototype the syntax for the underlying layout
in Vega soon.
There are also layout transforms that may make the term a bit overloaded.
Btw, I don't understand what's the issue here. Why don't you just add it? (What's the point of waiting? -- New people in the future will have to add their own new examples anyway.) A more interesting tasks is to modify your code to add box plot and dot plots to the margin instead.
I agree with @domoritz's suggestion that it would be useful to be able to get rid of the margins between the plots. Another use case is the so-called rug plot or dot-dash plot, in which ideally the marginal tick marks touch the domain of the main scatter plot.
Maybe allow the padding
property for each unit spec of a composed spec ?
Add a marginal histogram example. See https://www.tableau.com/about/blog/2015/11/how-make-scatterplot-marginal-histograms-45811.