标题和情节之间的空白 [英] white space between title and plot in ioslides
问题描述
我正在使用默认的ioslide主题进行演示,并且很难在幻灯片上布置图.
I am using the default theme of ioslides for a presentation, and I have difficulties with arranging a plot on the slide.
我在相应的幻灯片上使用以下代码:
I use the following code for the respective slide:
```{r crint1, fig.width = 7, fig.height = 5.5, fig.retina = NULL, fig.align="center"}
options(warn=-1)
load("path_to_data.RData")
ord <- order(cor.table$COR)
barplot(cor.table$COR[ord], names.arg=cor.table$group[ord],horiz=T
, cex.name=.6, border=F, space=.3, col="gray30",
xlab="Correlation Coefficient", las=1)
grid(NULL, NA, col="white", lty="solid", lwd=0.7)
abline(v=mean(cor.table$COR), lwd=2, lty=2, col="red")
text(mean(cor.table$COR), 1, "Average", cex=.8, col="red", pos=4)```
这将导致以下结果:
这没关系,但我希望该图从标题的下方开始,并在幻灯片上扩展更多,因此行的名称可读且不会重叠.
Which is okay, but I would like the plot to start right below the title and extend more on the slide, so the names of the rows are readable and don't overlap.
我尝试使用fig.height
和fig.width
,但是它们仅扩展了图的大小,并且不更改起始坐标(这使图扩展到了幻灯片之外).
I tried to play around with fig.height
and fig.width
, but they only extend the size of the plot and do not change the starting coordinates (which makes the plot extend beyond the slide).
是否有任何方法可以减少标题下方的空白并使用该边距扩展绘图?我假设我必须编辑该特定幻灯片的CSS,但不确定如何.感谢您的帮助.
Is there any way to reduce the white space below the title and use that margin to extend the plot? I assume I have to edit the CSS for that particular slide, I am just not sure how. Any help is appreciated.
推荐答案
您可以尝试以下操作:
选项1:
为幻灯片提供id
(此处为#slideID
)并更改边距:
Give your slide an id
(here it is #slideID
) and change the margins:
## Slide_title {#slideID}
<style>
#slideID > p {
margin-top: -50px;
}
</style>
选项2:
用图来标识幻灯片(在我的情况下,其id
是slide-1
并添加以下样式:
Identify the slide with the plot (in my case its id
is slide-1
and add the following styles:
<style>
#slide-1 > p {
margin-top: -50px;
}
</style>
该图包含在img
标记中.段落p
环绕在其周围.我们想将其向上移动50px
.
此外,您还可以更改绘图内部的边距,以最小化绘图区域上方的空白.
The plot is included with an img
tag. And a paragraph p
is wrapped around it. We want to move this one up by 50px
.
Additionally you can also alter the margin inside the plot to minimize the white space above the plotting area.
(为识别正确的幻灯片:打开演示文稿,显示带有图表的幻灯片,并在浏览器(或RStudio查看器)内部使用 inspect元素选项查看源代码)
(For identifying the correct slide: open the presentation, display the slide with the plot and use the inspect element option inside of a browser (or the RStudio viewer) to view the source code)
这篇关于标题和情节之间的空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!