删除 R 生成的图和 Rtex 文件中的标题之间的 space
Removing the space between a plot generated by R and the caption in an Rtex file
我正在尝试编辑 Rtex 文件并创建绘图。我在下面有一个情节,它确实可以编译。但是,标题下方有一个空白的白色space。我不知道如何删除它。我试图寻找解决方案但无济于事:
https://support.sisense.com/kb/en/article/remove-whitespace-margins-from-plotly-charts - 相关但为了情节。不是
能够使其适应我的 R 代码。
http://ostack.cn/qa/?qa=829717/ - 涉及 Python 而不是 R。我
无法将解决方案调整到 R 图中。
https://tex.stackexchange.com/questions/273786/latex-files-generated-by-tikzdevice-leaves-large-space-between-image-and-caption - 涉及 tikzpicture 而不是 R。我无法使解决方案适应 R 图。
我运行的代码以及输出如下所示。如果有人能帮助我,我将不胜感激。我也试过 trimmws() 函数,但它给出了以下错误:
## "Error in mysub(paste0("^", whitespace, "+"), x): argument"x" is missing, with no default."
\documentclass[a4paper,11pt]{article}
%Packages
\usepackage[justification=centering]{caption}
\usepackage{blindtext}
\begin{document}
\title{F-distribution}
\maketitle
\section{Diagram showing the $F$-distribution for a selected pair of values of the degree of freedom}
\blindtext
\begin{figure}[h!]
<<echo=FALSE, cache=TRUE, fig.width=5, fig.height=5>>=
curve(df(x, df1=20, df2=20))
@
\caption{Hi}
\end{figure}
\blindtext
\blindtext
\end{document}
您的图像周围确实有很多白色 space。您可以使用此快速技巧将标题进一步向上移动:
\documentclass[a4paper,11pt]{article}
%Packages
\usepackage[justification=centering]{caption}
\usepackage{blindtext}
\begin{document}
\title{F-distribution}
\maketitle
\section{Diagram showing the $F$-distribution for a selected pair of values of the degree of freedom}
\blindtext
\begin{figure}[h!]
<<echo=FALSE, cache=TRUE, fig.width=5, fig.height=5>>=
curve(df(x, df1=20, df2=20))
@
\vskip-1cm
\caption{Hi}
\end{figure}
\blindtext
\blindtext
\end{document}
我正在尝试编辑 Rtex 文件并创建绘图。我在下面有一个情节,它确实可以编译。但是,标题下方有一个空白的白色space。我不知道如何删除它。我试图寻找解决方案但无济于事:
https://support.sisense.com/kb/en/article/remove-whitespace-margins-from-plotly-charts - 相关但为了情节。不是 能够使其适应我的 R 代码。
http://ostack.cn/qa/?qa=829717/ - 涉及 Python 而不是 R。我 无法将解决方案调整到 R 图中。
https://tex.stackexchange.com/questions/273786/latex-files-generated-by-tikzdevice-leaves-large-space-between-image-and-caption - 涉及 tikzpicture 而不是 R。我无法使解决方案适应 R 图。
我运行的代码以及输出如下所示。如果有人能帮助我,我将不胜感激。我也试过 trimmws() 函数,但它给出了以下错误:
## "Error in mysub(paste0("^", whitespace, "+"), x): argument"x" is missing, with no default."
\documentclass[a4paper,11pt]{article}
%Packages
\usepackage[justification=centering]{caption}
\usepackage{blindtext}
\begin{document}
\title{F-distribution}
\maketitle
\section{Diagram showing the $F$-distribution for a selected pair of values of the degree of freedom}
\blindtext
\begin{figure}[h!]
<<echo=FALSE, cache=TRUE, fig.width=5, fig.height=5>>=
curve(df(x, df1=20, df2=20))
@
\caption{Hi}
\end{figure}
\blindtext
\blindtext
\end{document}
您的图像周围确实有很多白色 space。您可以使用此快速技巧将标题进一步向上移动:
\documentclass[a4paper,11pt]{article}
%Packages
\usepackage[justification=centering]{caption}
\usepackage{blindtext}
\begin{document}
\title{F-distribution}
\maketitle
\section{Diagram showing the $F$-distribution for a selected pair of values of the degree of freedom}
\blindtext
\begin{figure}[h!]
<<echo=FALSE, cache=TRUE, fig.width=5, fig.height=5>>=
curve(df(x, df1=20, df2=20))
@
\vskip-1cm
\caption{Hi}
\end{figure}
\blindtext
\blindtext
\end{document}