Latex Sweave R - 页面自行旋转

发布于 2024-10-01 01:20:10 字数 1527 浏览 5 评论 0原文

我刚开始使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白色秋天 2024-10-08 01:20:10

dvipdf -dAutoRotatePages=/None test.dvi

dvipdf -dAutoRotatePages=/None test.dvi

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文