I have been trying to make a polar violin plot but seem to get the bounding box. Here is my code and figure:
x <- matrix(runif(n=1000,-pi/2,pi/2),ncol =4 )
df <- reshape2::melt(x)
df$Var2 <- as.factor(df$Var2)
library(ggplot2)
df |>
ggplot(aes(
x = Var2,
y = value,
fill = Var2
)) +
geom_violin() +
theme_light() +
coord_polar() +
geom_hline(yintercept = 0) +
guides(fill = "none") +
theme(
axis.text.x = element_blank(), axis.ticks.x = element_blank(),
axis.text.y = element_blank(), axis.ticks.y = element_blank()
) +
labs(x = NULL, y = NULL)
But I get:
How do I get rid of the box around the figure? Thanks!
If I understand you correctly, you want to set panel.border to element_blank(). You can find the available settings for ggplot themes at https://ggplot2.tidyverse.org/reference/theme.html
x <- matrix(runif(n=1000,-pi/2,pi/2),ncol =4 )
df <- reshape2::melt(x)
df$Var2 <- as.factor(df$Var2)
library(ggplot2)
df |>
ggplot(aes(
x = Var2,
y = value,
fill = Var2
)) +
geom_violin() +
theme_light() +
coord_polar() +
geom_hline(yintercept = 0) +
guides(fill = "none") +
theme(
axis.text.x = element_blank(), axis.ticks.x = element_blank(),
axis.text.y = element_blank(), axis.ticks.y = element_blank(),
panel.border = element_blank()
) +
labs(x = NULL, y = NULL)