I want to change the background color of the radar chart. I don't see any argument that allow me to do this. Help?
Here's what I have so far:
structure(list(Acceptance = c(16, 4, 13), `Committed Action` = c(16,
4, 11), Diffusion = c(16, 4, 7), `Present Moment` = c(16, 4,
10), `Self as Context` = c(16, 4, 11), Values = c(16, 4, 12)), row.names = c(NA,
-3L), class = c("tbl_df", "tbl", "data.frame"))
# DF Structure
Acceptance `Committed Action` Diffusion `Present Moment` `Self as Context` Values
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 16 16 16 16 16 16
2 4 4 4 4 4 4
3 13 11 7 10 11 12
Graph:
radarchart(df, axistype=1,
#custom polygon
pcol="darkblue", pfcol=rgb(0.2,0.5,0.5,0.5), plwd=3,
#custom the grid
cglcol="grey50", cglty=1, axislabcol="black", caxislabels=seq(4,16,length.out = 5),
cglwd=2,
#custom labels
vlcex=1.8, calcex=1.8)
This is what I get:
I have tried:
g <- radarchart(df, axistype=1,
#custom polygon
pcol="darkblue", pfcol=rgb(0.2,0.5,0.5,0.5), plwd=3,
#custom the grid
cglcol="grey50", cglty=1, axislabcol="black", caxislabels=seq(4,16,length.out = 5),
cglwd=2,
#custom labels
vlcex=1.8, calcex=1.8)
g + theme(panel.background = element_rect(fill = "lightgray"))
# Output: NULL
Is there no way to add background color?
If your question addresses the use of
radarchart
from thefmbs
package, the first thing to note is that this produces a plot using base R graphics. Modifying the background usingtheme()
won't work becauseg
is not a ggplot object.Option 1: add a background to the entire plotting area setting graphical parameters for plotting
Option 2: If you want to use ggplot, you could install the ggradar package and produce your radar chart that way. It will look different but here's a start. https://github.com/ricardo-bion/ggradar