Reputation: 91
I've been using the ggRadar function from the ggiraphExtra package although have a couple of questions. Namely, how to change the line thickness and background gridline thickness.
I have tried changing the line thickness using geom_line but to no avail, as it doesn't interact with all lines. I have tried using theme(axis.etc) but can't interact with the gridlines (the background circles) in any way.
Here's a super simple example:
library(ggiraphExtra)
library(ggplot2)
data = as.data.frame(rbind(c(7,12,17,9)))
ggRadar(data, rescale = F, size=3)+
ylim(0,20)+
geom_line(size=2)
Any help would be greatly appreciated.
Thanks!
Upvotes: 2
Views: 1605
Reputation: 2581
You can easily modify the grid lines using panel.gridline.major
in theme
. Changing the thickness of the lines is somewhat harder but still possible.
p <- ggRadar(data, rescale = F, size = 4) +
ylim(0,20) +
theme(panel.grid.major = element_line(size = 2))
plot_obj <- ggplot_build(p)
plot_obj$data[[1]]$size <- 2
grid::grid.newpage()
grid::grid.draw(ggplot_gtable(plot_obj))
Modified (ugly, but proves the point).
Upvotes: 3
Reputation:
I thing that you have to modify the panel.grid element like I do here to change the size:
ggRadar(data, rescale = F, size=3)+
ylim(0,20)+
geom_line(size=1) + theme(panel.grid=element_line(size=2))
Upvotes: 3