Hi everyone,
I have a strip plot and struggling to overlay the median of each faceted group on this plot using Deneb’s in-visual calculation.
Kindly find the attached PBIX file below, which includes the work in progress and the target visual image.
Strip Plot with Median.pbix (1.8 MB)
Hi @Daniel_Derek.
To layer a median line over a strip plot (or any other plot, for that matter), use a standard layer block with nested blocks for the strip plot and the median line.
To create the faceted groups, one way is to use a standard explicit facet-spec syntax instead of an implicit “column” block in the encoding block.
Here’s the JSON specification code I used:
{
"data": {"name": "dataset"},
"spacing": 60,
"facet": {
"column": {"field": "Year"}
},
"spec": {
"height": 500,
"width": 300,
"encoding": {
"x": {
"field": "Index",
"type": "quantitative",
"scale": {"domain": [0, 110]},
"axis": {
"ticks": false,
"tickCount": 3,
"title": null
}
},
"y": {
"field": "Continent",
"type": "nominal",
"axis": {
"ticks": false,
"grid": false
}
}
},
"layer": [
{
"name": "STRIP_PLOT",
"mark": {
"type": "tick",
"color": "#BADAD8",
"tooltip": true
},
"encoding": {
"tooltip": [
{"field": "Country"},
{
"field": "Index",
"title": "CPI value"
}
]
}
},
{
"name": "MEDIAN",
"mark": {
"type": "line",
"color": "#FF0000",
"point": {
"type": "circle",
"stroke": "#FF0000",
"fill": "#FFFFFF",
"size": 200
}
},
"encoding": {
"x": {
"aggregate": "median",
"field": "Index",
"type": "quantitative"
}
}
}
]
}
}
Hope it helps.
Greg
eDNA Forum - Deneb Strip Plot with Median.pbix (1.8 MB)
2 Likes
That was very helpful, thank you so much @Greg
Kind regards
Daniel