我正在尝试调整投影仪对象中绘图的垂直对齐方式。这是一个例子:
\documentclass{beamer}
% To change margins for all slides
\setbeamersize{text margin left=0.5cm,text margin right=0.5cm}
\begin{document}
\title{Title of talk}
\author{John Doe}
\maketitle
\begin{frame}[fragile]
\frametitle{Make a plot}
Code:
<<plot_something, fig.width=3.5, fig.height=3.5, fig.align='center'>>=
plot(1:100, rnorm(100), ylab = "Random value")
@
\end{frame}
\end{document}
生成的.pdf文件中的绘图位置太远了。如何调整位置以便更有效地使用绘图上方的空白?
答案 0 :(得分:2)
我明白了。绘图对象的标准边距很宽,因此重置它们可以解决问题:
\documentclass{beamer}
% To change margins for all slides
\setbeamersize{text margin left=0.5cm,text margin right=0.5cm}
\begin{document}
\title{Title of talk}
\author{John Doe}
\maketitle
\begin{frame}[fragile]
\frametitle{Make a plot}
Code:
<<plot_something, fig.width=3.5, fig.height=2, fig.align='center'>>=
par(mai=c(0.4,0.4,0.2,0.2))
plot(1:100, rnorm(100), ylab = "Random value")
@
\end{frame}
\end{document}