Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go

Setting Output Width

Raw

\includegraphics[width=0.5\textwidth]{figures/onepager/knitr:example_figure_out_width-1}

We can use the out.width= and out.height= to adjust how much space a figure takes up in the final document. The above figure is reduced to fill just half the textwidth of the document using:

<<myfigure, fig.align="center", fig.width=3.5, out.width="0.5\textwidth">>=
... R code ...
@

If that is too wide, we can reduce it to 90% of the page width with:

<<myfigure, fig.align="center", fig.width=3.5, out.width="0.9\textwidth">>=
... R code ...
@

\includegraphics[width=0.9\textwidth]{figures/onepager/knitr:example_figure_out_width_0_9-1}


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.