Problem while arranging multiple plots

Hello there!!

I am having problem while arranging multiple plots. The code works with single plot. But, while I try to make one plot with ggarrange funciton or cowplot, It shows error: Error: Aesthetics must be either length 1 or the same as the data (23): x and y

I need to arrange these two plots in one.

xv<-seq(0.1,1.2,0.05)
yv<-exp(4.16646 )*xv^0.57728
obj<-data.frame(xv=xv,yv=yv)
xva<-seq(0.1,1.2,0.05)
yva<-exp(4.21661)*xva^0.57136
obj1<-data.frame(xv=xva,yv=yva)
VPD10=ggplot(M,mapping=aes(VPD,X10),pch=19)+
geom_point(size=3)+
geom_point(N,mapping = aes(VPD,X10),pch=1,size=3)+
geom_line(obj1,mapping = aes(xva,yva), color = "black", size = 0.4) +
geom_line(obj, mapping = aes(xv,yv), color = "black", size = 0.4,linetype="dashed")
VPD10

xv<-seq(5,30,5)
yv<-exp( 0.04882)*xv^1.25769 # model2 fit: intercept&slope from model2
obj<-data.frame(xv=xv,yv=yv)
xva<-seq(5,30,5)
yva<-exp(0.4869)*xva^1.1407
obj1<-data.frame(xv=xva,yv=yva)
Rg10=ggplot(M,mapping=aes(Rg,X10),pch=19)+
geom_point(size=3)+
geom_point(N,mapping = aes(Rg,X10),pch=1,size=3)+
geom_line(obj1,mapping = aes(xva,yva), color = "black", size = 0.4) +
geom_line(obj, mapping = aes(xv,yv), color = "black", size = 0.4,linetype="dashed")
Rg10

Error : object 'M' not found

Hello,
Here includes object M:
data <- read.csv ('Allday.csv', sep=",",stringsAsFactors=FALSE)

library(lubridate)
data$Dates<-as.POSIXct(data$Dates,format="%m/%d/%Y %H:%M")
library(dplyr)
data$Dates<-trunc(data$Dates,"day")

data1=data%>% group_by(Dates)%>%
summarize_at(vars(X1:X42),sum)
data2=data%>% group_by(Dates)%>%
summarize_at(vars(VPD),mean)
data3=data%>% group_by(Dates)%>%
summarize_at(vars(Rg),mean)
VPD=data2$VPD
(Rg=(data3$Rg/(100000))*10000)
Merged=data.frame(data1,VPD,Rg)
library(dplyr)
N <- Merged %>%
filter(Dates >= "2016-09-01" & Dates <= "2016-10-28")
M <- Merged %>%
filter(Dates >= "2016-10-29" & Dates <= "2016-12-17")
####################################
library(ggplot2)
windowsFonts(Times=windowsFont("TT Times New Roman"))
###################
Model1=lm(log(Merged$X1)~log(Merged$VPD))
summary(Model1)
plot(Merged$X1~Merged$VPD,ylab="Daily accumulated Js (g cm-2 d-1)",col=1, pch=1,xlab="VPD(kPa)")
..................................
After that, the previous code for VPD plot

Im afraid this is not helpful as it is not reproducible as it depends on your private csv file.
Here is a guide for you, advising how to make a reproducible example.

reproducible example (reprex)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.