Ggmap: error in annotation

I recently ran into problems with ggmap functions - never was.

I have this data.frame:

> head(df)
  longitude latitude freq
1 -118.7093 34.13446    2
2 -118.7092 34.13437    1
3 -118.6851 34.28574    5
4 -118.5986 34.26155    1
5 -118.5917 34.22762    6
6 -118.5914 34.37675    1

      

Previously, I could get a map using get_map and then draw plots of the bitmap using ggmap. Then I would use + geom_point or whichever for plotting my data worked like a charm.

map <- get_map(location=c(lon=-117.962813,lat=33.969399), zoom=10, maptype="hybrid")
finalmap <- ggmap(map, base_layer = ggplot(aes(x=longitude, y=latitude), data = df))

      

However, ggmap now returns:

Error in annotate("rect", xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax,  : 
  unused arguments (xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax, fill = darken[2], alpha = as.numeric(darken[1]))

      

How did anyone else come across this?

+3


source to share


2 answers


I faced the same problem and logged in for the first time to post my solution. It seemed like I was loading the package (after loading ggplot) using the "anotate" function (from the tm package), which was masking the annotation function from ggplot. If you enter annotation, you should see if the function you are calling is actually from the ggplot package or otherwise. Also be sure to check the messages when downloading packages.



Greetings

+5


source


The NLP package also has an annotated function ... You can turn off ggplot: detach("package:ggplot2", unload=TRUE)

and then load it again: library(ggplot2)

to make sure the function is what you want. Hope it helps.



+3


source







All Articles