Skip to content

Instantly share code, notes, and snippets.

@eliocamp
Created October 11, 2017 01:34
Show Gist options
  • Save eliocamp/7609fae98632b5af9a05d37262337bb9 to your computer and use it in GitHub Desktop.
Save eliocamp/7609fae98632b5af9a05d37262337bb9 to your computer and use it in GitHub Desktop.
Test for fig.ncol
---
title: "Untitled"
author: "Elio"
output:
pdf_document:
keep_tex: yes
fig_caption: yes
header-includes:
- \usepackage{subfig}
---
Some tests:
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Intended use:
```{r pressure, out.extra = "", echo = FALSE, fig.show = "hold", fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), fig.ncol = 2, out.width = "0.48\\textwidth"}
plot(pressure)
ggplot2::qplot(temperature, pressure, data = pressure)
plot(pressure)
```
Previous behaviour:
```{r pressure1, out.extra = "", echo = FALSE, fig.show = "hold", fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), out.width = "0.48\\textwidth"}
plot(pressure)
ggplot2::qplot(temperature, pressure, data = pressure)
plot(pressure)
```
Previous behaviour again:
```{r pressure5, out.extra = "", echo = FALSE, fig.show = "hold", fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), fig.ncol = 3, out.width = "0.48\\textwidth"}
plot(pressure)
ggplot2::qplot(temperature, pressure, data = pressure)
plot(pressure)
```
Centering works... interestingly:
```{r pressure3, out.extra = "", echo = FALSE, fig.show = "hold", fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), fig.ncol = 2, out.width = "0.48\\textwidth", fig.align='center'}
plot(pressure)
ggplot2::qplot(temperature, pressure, data = pressure)
plot(pressure)
```
Some stress testing:
One plot
```{r pressure4, out.extra = "", echo = FALSE, fig.show = "hold", fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), fig.ncol = 2, out.width = "0.48\\textwidth", fig.align='center'}
plot(pressure)
```
Negative
```{r pressure10, out.extra = "", echo = FALSE, fig.show = "hold", fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), fig.ncol = -1, out.width = "0.48\\textwidth", fig.align='center'}
plot(pressure)
```
No fig.show
```{r pressure11, out.extra = "", echo = FALSE, fig.cap = "Pressure", fig.subcap = c("one","two", "tree"), fig.ncol = -1, out.width = "0.48\\textwidth", fig.align='center'}
plot(pressure)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment