Home > OS >  ggradar returns Error: 'plot.data' contains value(s) > grid.max
ggradar returns Error: 'plot.data' contains value(s) > grid.max

Time:04-08

Given a sample data as follows:

df <- structure(list(date = c("2022-1-31", "2022-2-28"), PMI = c(50.1, 
50.2), PMI.import = c(48.4, 49), PMI.export = c(47.2, 48.6)), class = "data.frame", row.names = c(NA, 
-2L))

Out:

       date  PMI PMI.import PMI.export
1 2022-1-31 50.1       48.4       47.2
2 2022-2-28 50.2       49.0       48.6

I try to plot a radar plot with codes below, but none of them returns the plots I expected (need to show small difference of three variables in January and Febrary).

library(scales)
library(ggiraphExtra)
library(ggradar)

df %>% 
  mutate_each(funs(rescale), -date) %>%
  ggradar()

enter image description here

ggradar(df,
        values.radar = c("40", "50", "70"),
        grid.min=40, grid.mid=50, grid.max=60
)

enter image description here

and ggradar(df) returns: Error: 'plot.data' contains value(s) > grid.max

Does someone could help? I hope to set y limit ie., between 40~70 or 40~60 to show the small changes of data between two months if it's possible.

Reference:

enter image description here

  • Related