1
To illustrate the question I considered the hypothetical situation below, using the libraries ggplot2
and gridExtra
.
library(ggplot2)
library(gridExtra)
df<-data.frame(x=1:10,y=1:10)
a<-ggplot(data = df, aes(x = x, y=y^2)) + xlab("Posição") + ylab("Função") + ggtitle("Posição x Função")+geom_point()
b<-ggplot(data = df, aes(x = x, y=y^3)) + xlab("Posição") + ylab("Função") + ggtitle("Posição x Função")+ geom_point()
c<-ggplot(data = df, aes(x = x, y=y^4)) + xlab("Posição") + ylab("Função") + ggtitle("Posição x Função") + geom_point()
d<-ggplot(data = df, aes(x = x, y=y^5)) + xlab("Posição") + ylab("Função") + ggtitle("Posição x Função") + geom_point()
e<-ggplot(data = df, aes(x = x, y=y^6)) + xlab("Posição") + ylab("Função") + ggtitle("Posição x Função") + geom_point()
f<-ggplot(data = df, aes(x = x, y=y^7)) + xlab("Posição") + ylab("Função") + ggtitle("Posição x Função") + geom_point()
grid.arrange(a,b,c,d,e,f)
How can I plot the graphics generated by this routine on an A4 sheet taking into account that:
- The orientation of the sheet is Portrait and its left, upper, right and lower margins are respectively 3.3.2 and 2 centimeters;
- The graphs are arranged side by side in two columns with 0.5cm distance between them, a grid of 3x2;
- The font size of the title is 12 and the caption size is 10.
Jean, two details: 1. There is a parenthesis left/missing in your first line. 2. Always put the code to load the packages when asking a question or giving an answer, by code it is not possible to know which packages are needed.
– Molx
Do you care only about the margin, or also about the space that graphics will occupy? And the alignment on the page?
– Molx
@Molx - Thanks for the corrections. I had not thought of details beyond the margins... but I will improve the question.
– Jean
@Jean, I’m sorry to ask, but what’s the point of this? Maybe use the
sweave
is a more appropriate approach, depending on your objective.– Bernardo
@Bernado, I tried to create a problem similar to what I came across, created several graphs and need to print them in an organized way. I will check the
sweave
. Thank you!– Jean