Reputation: 203
With following chunk the left alignment doesn't work. The resulting map has still the same left border as without fig.align='left'
\documentclass[a4paper, oneside, british]{book}
\begin{document}
<<chunk.maps, fig.height=12, fig.width=21, out.width="6in", fig.align='left'>>=
library(knitr)
library(maptools)
data(wrld_simpl)
plot(wrld_simpl)
box()
@
\end{document}
I would greatly appreciate any help with this!
Thanks, Gerit
Upvotes: 1
Views: 3359
Reputation: 30164
It is not because fig.align="left"
does not work; as @joran said in the comments, it does work if you make the plot smaller. There are two problems that caused the artifact:
par(mar)
is not 0 on the left margin by default; see ?par
; set par(mar = c(0, 0, 0, 0))
solves this problem\parindent
)To make the plot touch the left margin, try this:
\documentclass{book}
\setlength{\parindent}{0pt}
\begin{document}
<<chunk.maps, fig.height=12, fig.width=21, out.width="6in", fig.align='left'>>=
library(maptools)
data(wrld_simpl)
par(mar = c(0, 0, 0, 0))
plot(wrld_simpl)
box()
@
\end{document}
If you are uncomfortable with setting \parindent
to 0, you can restore it after the chunk.
Upvotes: 2