I want to make a bubble map using ggplot. The current map I have looks like this, I want to add bubbles that represent the number of births in each region (regions that have more births would have a much bigger bubble):
I made the map using the following code:
ggplot() +
# county polygons
geom_polygon(data =shapefile_df, aes(fill = mean_birth_weight,
x = long,
y = lat,
group = group), colour = "black") +
# county outline
geom_path(data = shapefile_departamentos, aes(x = long, y = lat, group = group),
color = "black", size = 1) +
coord_equal() +
scale_fill_distiller(palette = "RdYlGn", direction=1, breaks = c(2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300,
3400, 3500), limits = c(2600, 3600), na.value = "black") +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank())
But when I tried to add geom_point to it, the map that resulted it, looked like this:
My guess is that bubbles were drawn in the borders of the map, but there are a lot of them. The code I used for the last map was this:
ggplot() +
# county polygons
geom_polygon(data =shapefile_df, aes(fill = mean_birth_weight,
x = long,
y = lat,
group = group), colour = "black") +
geom_point(data = shapefile_df, aes(x=long, y=lat, group = group, size = Total))+
# county outline
geom_path(data = shapefile_departamentos, aes(x = long, y = lat, group = group),
color = "black", size = 1) +
coord_equal() +
scale_fill_distiller(palette = "RdYlGn", direction=1, breaks = c(2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300,
3400, 3500), limits = c(2600, 3600), na.value = "black") +
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank(),
axis.title = element_blank(),
axis.text = element_blank(),
axis.ticks = element_blank())