[GIS] Map with ggplot2 and bubbles

ggplot2mapsr

enter image description here

I've tried to plot a map of magnitude earthquakes in Colombia with ggplot. After many efforts, I got it. But, I need to focus in specially area where the data of magnitudes is (4, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, 5). When I use the same script for this data, I get this:

"Error: Discrete value supplied to continuous scale".

I've used many solutions in blogs but it does not work.

This is my first map and the script

santos <- readOGR("Departamentos_WGS84.shp","Departamentos_WGS84")
map <- fortify(santos)
datos=read.table("coord.txt",header=T,dec=",",sep=";")
myData = data.frame(datos)

gg <- ggplot()
gg <- gg + geom_map(data=map, map=map,
                    aes(x=long, y=lat, map_id=id, group=group),
                    fill="#fffcfc", color="#0e0e0e", size=0.15) + 
                    geom_point(data=myData, 
                    aes(x=long, y=lat, size=Magnitud), color = "red",shape = 21) +
                    scale_size(range = c(0, 8)) + 
                    coord_map() + 
                    theme_bw() + 
                    labs(x=NULL, y=NULL) + 
                    theme(panel.grid=element_blank()) + 
                    theme(panel.border=element_rect())
                    gg

Best Answer

I solved this problem with these instructions:

myData$longitude = as.numeric(as.character(myData$longitude))

myData$Magnitude = as.numeric(as.character(myData$Magnitude))

myData$latitude = as.numeric(as.character(myData$latitude))