I am trying to plot the data using the ggplot2 package, but I am crossing with an error: the data are set of columns which represents every day values (the values change in altitude)
V1 V2.... V500
2E-15.....3E-14
3e-14.....3E-21
1.3E-15....NA
I want to plot all the data in two axis with a fill of the values.
Code;
a<-data.frame("/../vertical_value.csv",sep=",",header=F)
am<-melt(t(a))
dataset<-expand.grid(X = 1:500, H = seq(1,25,by=1))
dataset$axp<-am$value
g<-ggplot(dataset, aes(x = X, y = H, fill = axp)) + geom_tile()
error:
Error: Casting formula contains variables not found in molten data: XHaxp
Looking at this again, I think that you should be able to bypass this just by dropping NA rows after you melt.
a<-data.frame("/../vertical_value.csv",sep=",",header=F)
am<-melt(t(a))
am <- na.omit(am) ## ADD THIS LINE
dataset<-expand.grid(X = 1:500, H = seq(1,25,by=1))
dataset$axp<-am$value
g<-ggplot(dataset, aes(x = X, y = H, fill = axp)) + geom_tile()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.