Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crop plot when using fewer rows #96

Open
rempsyc opened this issue Jun 4, 2023 · 0 comments
Open

Crop plot when using fewer rows #96

rempsyc opened this issue Jun 4, 2023 · 0 comments

Comments

@rempsyc
Copy link

rempsyc commented Jun 4, 2023

I reported a space optimization issue on RStudio Forums when using waffle::waffle() in conjunction with flexdashboard::flex_dashboard() . I think the issue stems from the actual plot keeping the same height instead of adjusting based on the number of rows.

Reprex:

---
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(waffle)
```

### Chart A

```{r}
parts <- c(One=80, Two=30, Three=20, Four=10)
waffle(parts, rows=5)
```

### Chart B

```{r}
waffle(parts, rows=5, size = 1)
```

### Chart C

```{r}
waffle(parts, rows=5, size = 4, legend_pos = "bottom")
```

### Chart D

```{r, fig.width = 10, fig.height = 8}
waffle(parts, rows=5)
```

Using a single panel:

A solution would be to automatically crop the plot based on the height of the actual drawing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant