Skip to content
Prev 377749 / 398502 Next

[R studio] Plotting of line chart for each columns at 1 page

Dear Sir,

The method you suggested for arranging multiple plots in 1 pdf page has
finally worked.

Thank you very much.

But, I have 3 more queries as follows.

1. Is there any way that I can merge the respective plots from the
different excel files into 1? For instance, I have 3 excel files (i.e. EMs
1, EMs 2 and EMs 3) having 4 plots each. I want to merge 1st plots from 3
excel files into 1, 2nd plots from 3 excel files into 1, similarly 3rd and
4th plots from each respective files into 1?
2. Is there any way to range the scale of Y-axis for all plots because I
think if the range of the Y-axis for each plot is same, it can be easy to
interpret and compare the results. I used Ylim function. But, after using
the Ylim function, the plot is looking unclear than before. For your
convenience, I am providing my code.

pdf("EMs.pdf",width=20,height=20)
par(mfrow=c(5,4))
# import your first sheet here (38 columns)
ncolumns<-ncol(EMs1)
for(i in 1:ncolumns)
  plot(EMs1[,i],type="l",col = "Red", xlab="Time",
       ylab="APEn", ylim=c(0.1,2), main=names(EMs1)[i])
library(zoo)
*APEn=zoo(EMs1, seq(from = as.Date("1994-01-01"), to =
as.Date("2017-08-03"), by = 1))*
#import your second sheet here, (10 columns)
ncolumns<-ncol(EMs2)
for(i in 1:ncolumns)
  plot(EMs2[,i],type="l",col = "Red", xlab="Time",
       ylab="APEn",ylim=c(0.1,2), main=names(EMs2)[i])
*APEn=zoo(EMs2, seq(from = as.Date("1994-01-01"), to =
as.Date("2017-08-03"), by = 1))*
# import your Third sheet here, (2 columns)
ncolumns<-ncol(EMs3)
for(i in 1:ncolumns)
  plot(EMs3[,i],type="l",col = "Red", xlab="Time",
       ylab="APEn", ylim=c(0.1,2), main=names(EMs3)[i])
*APEn=zoo(EMs3, seq(from = as.Date("1996-01-01"), to =
as.Date("2017-08-03"), by = 1))  *
# finish plotting
dev.off()

3. I want the corresponding date column (which is the daily date) on X-axis
of each plot. Thus, I added 1 line after the plot in the above (i.e. the
bold line). Please suggest me Is it the correct way that I am doing?


Sir, I am new in R and doing by learning.

Kindly suggest me regarding my previous queries for which I shall be always
grateful to you.

Thank you very much for educating a new R learner.




On Wed, Nov 21, 2018 at 3:20 PM Subhamitra Patra <subhamitra.patra at gmail.com>
wrote:

  
    
Message-ID: <CAOFE=kN6uZ9mKCkfDkz+xXLMxs3+WBu=A3YFAP-0UWt_b5V1FA@mail.gmail.com>
In-Reply-To: <CAOFE=kN_tdNCzu50RhVM4-k7d6psEd=vZu7pD0htdczBKSn-HQ@mail.gmail.com>