I'm trying to plot a continuous variable on space. I saw this example that gets the same result that I need:
library("MASS")
library("ggplot2")
library(reshape2)
DB<-melt(volcano)
ggplot(DB, aes(x=Var1, y=Var2, fill=value)) +geom_tile()
So I did with my data:
library(repmis)
url<-"https://www.dropbox.com/s/4m5qk32wjgrjq40/dato.RDATA"
source_data(url)
library(ggplot2)
ggplot(dato,aes(y=variable,x=y,fill=value))+geom_tile()
That's wonderful. But my "x" and "y" are kilometers distance (east and north) from a point in space. I transformed these in latitude and longitude. But now my plot doesn't work!
ggplot(dato,aes(y=lat,x=long,fill=value))+geom_tile()
I don't understand why. Anyway plotting my data like points the result is very similar:
ggplot(dato,aes(y=lat,x=long,fill=value))+geom_point()
ggplot(dato,aes(y=variable,x=y,fill=value))+geom_point()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…