I am trying to make a quarto
presentation using revealjs
. When the ggplot
renders (page 2; see below for a reproducible example) there is a black border around the rendered plot. How can one remove this border?
Quarto revealjs presentation code:
---
title: "Test Presentation"
format:
revealjs:
theme: [default, custom.scss]
---
## Some plot
```{r}
library(ggplot2)
ggplot(mtcars) +
geom_boxplot(aes(as.factor(cyl), disp, fill = cyl)) +
theme_minimal() +
theme(
legend.position = "none",
panel.grid = element_blank(),
axis.title = element_text(size = 20, color = "#fefefe"),
axis.text = element_text(size = 15, color = "#fefefe"),
plot.title = element_text(size = 20, color = "#fefefe"),
plot.background = element_rect(fill = "#505050"),
panel.background = element_rect(fill = "#505050"),
axis.line.x.top = element_line(color = "#fefefe"),
axis.line.x.bottom = element_line(color = "#fefefe"),
axis.line.y.left = element_line(color = "#fefefe"),
axis.line.y.right = element_line(color = "#fefefe")
) +
guides(x.sec = "axis", y.sec = "axis")
```
custom.scss code:
/*-- scss:defaults --*/
// fonts
$font-family-sans-serif: "Palatino Linotype", "Book Antiqua", Palatino,
FreeSerif, serif !default;
// colors
$body-bg: #505050;
$body-color: #ffffff;
$link-color: #51483d !default;
$selection-bg: #26351c !default;
// headings
$presentation-heading-font: "Palatino Linotype", "Book Antiqua", Palatino,
FreeSerif, serif !default;
$presentation-heading-color: #ffffff !default;
/*-- scss:rules --*/
.reveal a {
line-height: 1.3em;
}
To remove the border around your plot set e.g. color = NA
or size=NA
in theme option plot.background
:
---
title: "Test Presentation"
format:
revealjs:
theme: [default, custom.scss]
---
## Some plot
```{r}
library(ggplot2)
ggplot(mtcars) +
geom_boxplot(aes(as.factor(cyl), disp, fill = cyl)) +
theme_minimal() +
theme(
legend.position = "none",
panel.grid = element_blank(),
axis.title = element_text(size = 20, color = "#fefefe"),
axis.text = element_text(size = 15, color = "#fefefe"),
plot.title = element_text(size = 20, color = "#fefefe"),
plot.background = element_rect(fill = "#505050", color = NA),
panel.background = element_rect(fill = "#505050"),
axis.line.x.top = element_line(color = "#fefefe"),
axis.line.x.bottom = element_line(color = "#fefefe"),
axis.line.y.left = element_line(color = "#fefefe"),
axis.line.y.right = element_line(color = "#fefefe")
) +
guides(x.sec = "axis", y.sec = "axis")
```