Endre Endre - 1 year ago 234
Markdown Question

white space between title and plot in ioslides

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"}
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 results in this:

link to image

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.

I tried to play around with
, but they only extend the size of the plot and do not change the starting coordinates (which makes the plot extend beyond the slide).

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.

Answer Source

You can try the following:

Option 1:

Give your slide an id (here it is #slideID) and change the margins:

## Slide_title {#slideID} 
  #slideID > p { 
    margin-top: -50px; 

Option 2:

Identify the slide with the plot (in my case its id is slide-1 and add the following styles:

    #slide-1 > p {
      margin-top: -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.

enter image description here

(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)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download