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"))

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