No color gradient with geom_raster

I'm trying to build a bitmap (ocean bathymetry) using geom_raster, but it's hard for me to break the code. I would appreciate any help.

I downloaded the following xyz file (Dropbox link).

SF.bath <- read.table("SF_bath.txt", header=F,col.names=c("lon","lat","z"))
> head(SF.bath)
       lon     lat   z
1 -67.9917 50.9968 757
2 -67.9750 50.9968 693
3 -67.9583 50.9968 673
4 -67.9417 50.9968 769
5 -67.9250 50.9968 761
6 -67.9084 50.9968 733

When I try to use the following code, colors are not displayed on my map?

v <- ggplot(SF.bath, aes(lon, lat,z=z))
print(v + geom_raster(aes(fill=z)) + stat_contour(size=0.2) + scale_fill_gradient("z"))

map

I get the following message: Using alpha as value column: use value_var to override.Any ideas on what might be the problem?

+3
source share
1 answer

EDITED underline key answer

The code in the question with the provided data set achieves the desired result:

plot of SF_bath

, , , update.packages() .

+6