Minimizing gaps around graphs when using tikzDevice in R
I am using
in R to write code
for placing graphs in LaTeX documents. I found that there is a gap around the plots i.e. The margin is usually excessive.
Below is a minimal example of exporting an R chart as tikz code:
x <- seq(30, 70) probs <- dbinom(x, size=100, prob=0.5) library(tikzDevice) tikz('binomial.tex', standAlone = T, width=3, height=2.5) barplot(names.arg=x, probs, cex.names=0.6, cex.axis=0.6) dev.off()
it gives a small pdf file, where, as you can see, there are a lot of spaces in the margins. Ideally, I would like there to be no spaces at all under the x-axis point labels, or to the left of the y-axis point labels, etc.
By the way, when pasting into a LaTeX document, I will always use
in the command
above and then use
in the document. There is no difference in space, which is easy to check with
. It also
Does anyone still know where I can remove all the spaces from the fields of these parcels?
source to share