function baseHisto(col) {
const histoWidth = width / 4;
const histoHeight = 450 / 4;
const margin = ({top: 10, right: 20, bottom: 50, left: 80})
const svg = d3.create('svg')
.attr('width', histoWidth + margin.left + margin.right)
.attr('height', histoHeight + margin.top + margin.bottom);
const g = svg.append("g")
.attr("transform", `translate(${margin.left}, ${margin.top})`);
const x = d3.scaleLinear()
.range([0, histoWidth])
.domain(d3.extent(cars, d => d[col])).nice();
const histogram = d3.bin()
.value(d => d[col])
.domain(x.domain());
const bins = histogram(cars);
const y = d3.scaleLinear()
.range([histoHeight, 0])
.domain([0, d3.max(bins, d => d.length)]).nice();
const xAxis = d3.axisBottom(x);
const xAxisGroup = g.append("g")
.attr("transform", `translate(0, ${histoHeight})`);
xAxisGroup.append("text")
.attr("x", 0)
.attr("y", 33)
.attr("fill", "black")
.attr("font-weight", "bold")
.attr("text-anchor", "start")
.text(col);
xAxisGroup.call(xAxis);
const yAxis = d3.axisLeft(y).ticks(3);
const yAxisGroup = g.append("g").call(yAxis)
.call(g => g.selectAll('.tick line')
.clone()
.attr('stroke', '#d3d3d3')
.attr('x1', 0)
.attr('x2', histoWidth))
let barsGroup = g.append("g");
barsGroup.selectAll("rect")
.data(bins)
.join("rect")
.attr("fill", "steelblue")
.attr("x", d => x(d.x0) + 1)
.attr("width", d => x(d.x1) - x(d.x0) - 1)
.attr("y", d => y(d.length))
.attr("height", d => histoHeight - y(d.length));
return svg.node();
}