Latex Sweave R - 页面自行旋转
我刚开始使用 Sweave 和 Latex,并且遇到了一些小问题。 这是放入其自己的 tex 文件中的文档片段。
\documentclass[a4paper,10pt]{article}
\usepackage[dvips]{graphicx}
\usepackage{Sweave}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% END PREAMBLE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{plain}
\begin{figure}
\begin{center}
<<fig=TRUE,echo=FALSE>>=
data=read.table("adult_dataset/adult.data", sep=",");
age=c(t(data[1]));
fnlwgt=c(t(data[3]));
education_num=c(t(data[5]));
cap_gain=c(t(data[11]));
cap_loss=c(t(data[12]));
hrs_week=c(t(data[13]));
labels=c("Age", "Final weight", "Education num", "Capital gain", "Capital loss", "Hours per week");
dframe=data.frame(age, fnlwgt, education_num, cap_gain, cap_loss, hrs_week);
par(mfrow=c(2,3));
for (i in c(1:6) ){
boxplot(dframe[i], main=labels[i]);
}
@
\label{fig:boxplots}
\caption{Boxplots of numerical features}
\end{center}
\end{figure}
\end{document}
Adult.data 是 http://archive.ics.uci .edu/ml/machine-learning-databases/adult/adult.data 我编译:
R CMD Sweave test.rnw && latex test.tex && dvipdf test.dvi
这产生了一个水平的页面。 它的尺寸是正确的,但旋转了 90 度。 不是图片,而是整个页面。
我可以做什么来解决这个问题? 这是正常行为吗?
谢谢您的任何建议:)
I am new to using Sweave with Latex, and am having some small troubles.
Here is the segment of the document put into it's own tex file.
\documentclass[a4paper,10pt]{article}
\usepackage[dvips]{graphicx}
\usepackage{Sweave}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% END PREAMBLE %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{plain}
\begin{figure}
\begin{center}
<<fig=TRUE,echo=FALSE>>=
data=read.table("adult_dataset/adult.data", sep=",");
age=c(t(data[1]));
fnlwgt=c(t(data[3]));
education_num=c(t(data[5]));
cap_gain=c(t(data[11]));
cap_loss=c(t(data[12]));
hrs_week=c(t(data[13]));
labels=c("Age", "Final weight", "Education num", "Capital gain", "Capital loss", "Hours per week");
dframe=data.frame(age, fnlwgt, education_num, cap_gain, cap_loss, hrs_week);
par(mfrow=c(2,3));
for (i in c(1:6) ){
boxplot(dframe[i], main=labels[i]);
}
@
\label{fig:boxplots}
\caption{Boxplots of numerical features}
\end{center}
\end{figure}
\end{document}
adult.data is http://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.data
I compile with:
R CMD Sweave test.rnw && latex test.tex && dvipdf test.dvi
This produced a page which is horizontal.
It is the correct size, but it is rotated 90 degrees.
Not the picture, but the whole page.
What can I do to fix this?
Is this normal behavior?
Thank you for any suggestions :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dvipdf -dAutoRotatePages=/None test.dvi
dvipdf -dAutoRotatePages=/None test.dvi