The error message is telling you that there is no z variable in one of the two datasets that you are using in your ggplot call. If the gdat <- interp2xys(...) is running without giving an error, then it is likely the geom_point(data = Space) giving you an issue. First try adding fill = NULL to your geom_point() function as it is likely trying to find the z variable you pass to your aes call and can not find it. The geom_point() line would look like this:
geom_point(data = Space, mapping = aes(Longitud.E.,Latitude.S.),shape=1, fill = NULL)
If that does not work then your gdat data is likely not being calculated correctly.
That aes call you have on the second line of the plotting code should either be inside the ggplot call or inside one of the geom_ calls. That could be causing you problems
(If you put it inside ggplot(), it'll be inherited by all of the geoms unless they override it.)
Unfortunately, Both solutions do not work. R gives me the same error.
It is wired that now ggplot does not found the parameters x, y, z of gdat.
these are the structures of gdat and fld:
str(gdat)
'data.frame': 1600 obs. of 3 variables:
$ x: num 37.3 37.3 37.4 37.4 37.4 ...
$ y: num 45.7 45.7 45.7 45.7 45.7 ...
$ z: num NA NA NA NA NA NA NA NA NA NA ...
> str(fld)
List of 3
$ x: num [1:40] 37.3 37.3 37.4 37.4 37.4 ...
$ y: num [1:40] 45.7 45.8 45.8 45.9 45.9 ...
$ z: num [1:40, 1:40] NA NA NA NA NA NA NA NA NA NA ...
Searching around into the web, I found the solution of the enigma.
I have to add the last line inherit.aes = FALSE, like this: geom_point(data = Space, mapping = aes(Longitud.E., Latitude.S.),shape=1, inherit.aes = FALSE)