I know this question has been asked several times here . But I seem to be getting the same error message "Discrete value supplied to continuous scale" even when I think my code is good enough. I don't understand the reason. I import the longitude and latitude value from a csv file and construct a data frame. But I am not able to plot the points on the map all I am getting is a map of Europe with no points.
library(ggmap)
library(ggplot2)
g <- data.frame(lon=longitude, lat=latitude)
Europe <- get_map(location="Europe", zoom=3)
map <- ggmap(Europe)
map + geom_point(data=g, aes(x=longitude, y=latitude), color="blue", size=3)
sample data:
latitude
28.42222222
29.76328
18.079733
19.2539846
27.66955857
23.1525609
12.958251
16.3577847
28.5912216
19.254039
25.1450198
23.15276151
19.2539879
19.253986
28.6598034
23.1530814
longitude
100.7680556
95.36327
73.418583
73.1403781
84.42628936
79.9333897
77.5543671
80.8691776
77.1237985
73.1403918
85.2033903
79.9332153
73.140418
73.1404192
77.1903172
79.9329372
EDITED DPUT
> dput(g)
structure(list(lon = structure(c(1L, 16L, 6L, 2L, 14L, 12L, 9L,
13L, 7L, 3L, 15L, 11L, 4L, 5L, 8L, 10L), .Label = c("100.7680556",
"73.1403781", "73.1403918", "73.140418", "73.1404192", "73.418583",
"77.1237985", "77.1903172", "77.5543671", "79.9329372", "79.9332153",
"79.9333897", "80.8691776", "84.42628936", "85.2033903", "95.36327"
), class = "factor"), lat = structure(c(13L, 16L, 3L, 4L, 12L,
8L, 1L, 2L, 14L, 7L, 11L, 9L, 6L, 5L, 15L, 10L), .Label = c("12.958251",
"16.3577847", "18.079733", "19.2539846", "19.253986", "19.2539879",
"19.254039", "23.1525609", "23.15276151", "23.1530814", "25.1450198",
"27.66955857", "28.42222222", "28.5912216", "28.6598034", "29.76328"
), class = "factor")), .Names = c("lon", "lat"), row.names = c(NA,
-16L), class = "data.frame")

str(g)? Are both columns numerics? Also, the geom_point() points to your originallongitudeandlatitudevectors, but your columns ingare namedlonandlat. - user2034412