Example of how to use the d3-hexgrid plugin with Canvas.
More examples... Farmers Markets I: SVG • Farmers Markets II: SVG and interaction • Military disputes: SVG with clipping • Post boxes: Canvas • all examples on Observable
xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cities</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- d3-hexgrid script comes first. -->
<script src="//unpkg.com/d3-hexgrid"></script>
<script src="//unpkg.com/d3"></script>
<script src="//unpkg.com/d3-geo-projection"></script>
<script src='//unpkg.com/simple-statistics'></script>
</head>
<body>
<div id="container">
<canvas></canvas>
</div>
<script src="app.js"></script>
</body>
</html>
https://unpkg.com/d3-hexgrid
https://unpkg.com/d3
https://unpkg.com/d3-geo-projection
https://unpkg.com/simple-statistics