plot using ggplot function

Hi, I try to plot GWR coefficients using ggplot function (ggplot2) package, the function is the following: gwr.point1<-ggplot(LondonWards, aes(x=x,y=y))+geom_point(aes(colour=LondonWards$coefjobindex))+scale_colour_gradient2(low ="red", mid = "white", high = "blue", midpoint = 0, space = "rgb", na.value = "grey50", guide = "colourbar", guide_legend(title="Coefs"))gwr.point1+geom_path(data=boroughoutline,aes(long, lat, group=id), colour="grey")+coord_equal()

I get the message: Erreur : unexpected symbol in "plot(LondonWards, aes(x=x,y=y))+geom_point(aes(colour=LondonWards$coefjobindex))+scale_colour_gradient2(low ="red", mid = "white", high = "blue", midpoint = 0, space = "rgb", na.value = "grey5"

I don't know what is the problem with this sentence.
thanks for helping me

I invented some data and ran your first call to ggplot without any error. I cannot run the second part because I do not have that data set. Do you get an error in the ggplot call that generates gwr.point1?

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 3.5.3

LondonWards <- data.frame(x = 1:30, y = 1:30, coefjobindex = rnorm(30, 0, 5))

gwr.point1 <- ggplot(LondonWards, aes(x=x,y=y))+
  geom_point(aes(colour=LondonWards$coefjobindex))+
  scale_colour_gradient2(low ="red", mid = "white", high = "blue", 
                         midpoint = 0, space = "rgb", na.value = "grey50", 
                         guide = "colourbar", guide_legend(title="Coefs"))
#> Warning: Non Lab interpolation is deprecated
gwr.point1

Created on 2019-11-01 by the reprex package (v0.3.0.9000)

1 Like

HI FJCC,
I try what you are mentioned in the box, but i get the same graphic as you. it should be a cart . i don't have any problem with the ggplot function, i have a problem with aes(x,y, group=id)

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.