The answer provided here by mgri (which I think would work great in QGIS 2) unfortunately won't work in QGIS 3 as the "QgsMapLayerRegistry"QgsMapLayerRegistry
is no longer recognized (please see Was QgsMapLayerRegistry being removed in QGIS 3?).
QGIS 3 now includes a point cluster renderer that will accomplish this same result out-of-the-box, without additional coding: https://north-road.com/2016/09/06/point-cluster-renderer-crowdfunding-successful/
Video explaining how to setup and configure is here: https://www.youtube.com/watch?v=gNL-ZSlc4KM
Also please see here: https://anitagraser.com/2017/06/13/even-more-aggregations-qgis-point-cluster-renderer/
Thank you!