1

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
3

1 Answer 1

1

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.