How can I save grid arrange plot to file

0 votes
May 16, 2018 in Data Analytics by shams
• 3,670 points
6,983 views

1 answer to this question.

0 votes
grid.arrange() directly draws on our device.
However, arrangeGrob doesn't draw anything but returns a grob g, which can be passed to ggsave(file="something.pdf", g).

 # draw your plots
 p1 <- ggplot(...) # first plot
 p2 <- ggplot(...) # second plot
 p3 <- ggplot(...) # third plot

 #merge all plots within one grid
 grid.arrange(p1, p2, p3, nrow=3) #arranges plots within grid

 #save
 g <- arrangeGrob(p1, p2, p3, nrow=3) #generates g
 ggsave(file="something.pdf", g) #saves g
answered May 16, 2018 by zombie
• 3,790 points

Related Questions In Data Analytics

0 votes
1 answer

How can I import a file in R without giving the destination/file path to the specified file?

You can use the window explorer to ...READ MORE

answered Aug 28, 2018 in Data Analytics by Abhi
• 3,720 points

edited Aug 28, 2018 by Vardhan 3,041 views
0 votes
1 answer

How can I use R to list all files with a specified extension ?

fls <- list.files(pattern = "\\.dbf$") $ at the ...READ MORE

answered May 11, 2018 in Data Analytics by zombie
• 3,790 points
904 views
0 votes
1 answer

How can I find file name from full file path in R?

You can use: basename("C:/some_dir/filename.ext") # [1] "filename. ...READ MORE

answered May 24, 2018 in Data Analytics by zombie
• 3,790 points
1,353 views
0 votes
1 answer

How can I read a .csv file in R language?

read.csv () function is used to read ...READ MORE

answered Jun 12, 2018 in Data Analytics by zombie
• 3,790 points
763 views
0 votes
1 answer

How can I convert a factor variable to numeric in R ?

A factor variable can be converted to ...READ MORE

answered Sep 19, 2018 in Data Analytics by shams
• 3,670 points
3,842 views
0 votes
1 answer

How can I convert a list to a dataframe?

L = ['1', '2','3','4','5'] #create new df df ...READ MORE

answered Sep 19, 2018 in Data Analytics by Abhi
• 3,720 points
599 views
+1 vote
2 answers
+1 vote
1 answer

Error saying cannot open file 'file.pdf' when trying to save a plot in ggplot

You could try adding the following line ...READ MORE

answered Nov 9, 2018 in Data Analytics by Maverick
• 10,840 points
8,048 views
0 votes
1 answer

How can I remove plot axis values?

In order to remove numbering on x-axis ...READ MORE

answered May 8, 2018 in Data Analytics by zombie
• 3,790 points
692 views
0 votes
1 answer

How can I append rows to an R data frame?

Consider a dataSet i.e cicar(present under library ...READ MORE

answered May 9, 2018 in Data Analytics by zombie
• 3,790 points
10,812 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP