Log-scaled Histogram
Log-scaled Histogram. We may improve the support of this. See https://github.com/vega/vega-lite/issues/4792.
View this example in the online editor
Vega-Lite JSON Specification
{
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"description": "Log-scaled Histogram. We may improve the support of this. See https://github.com/vega/vega-lite/issues/4792.",
"data": {
"values": [
{"x": 0.01},
{"x": 0.1},
{"x": 1},
{"x": 1},
{"x": 1},
{"x": 1},
{"x": 10},
{"x": 10},
{"x": 100},
{"x": 500},
{"x": 800}
]
},
"transform": [{
"calculate": "log(datum.x)/log(10)", "as": "log_x"
}, {
"bin": true,
"field": "log_x",
"as": "bin_log_x"
}, {
"calculate": "pow(10, datum.bin_log_x)", "as": "x1"
}, {
"calculate": "pow(10, datum.bin_log_x_end)", "as": "x2"
}],
"mark": "bar",
"encoding": {
"x": {
"field": "x1",
"type": "quantitative",
"scale": {"type": "log", "base": 10},
"axis": {"tickCount": 5}
},
"x2": {
"field": "x2"
},
"y": {
"aggregate": "count",
"type": "quantitative"
}
}
}