ggiraphExtra icon indicating copy to clipboard operation
ggiraphExtra copied to clipboard

Compatibility with `facet_wrap`

Open kota7 opened this issue 5 years ago • 0 comments

I am trying to draw radar charts in different panels.

This works:

library(ggiraphExtra)
x <- data.frame(
    student=c("John", "Ken"),
    A=c(80, 65),
    B=c(70, 85),
    C=c(70, 70),
    D=c(72, 67),
    E=c(100, 90)
)

ggRadar(x, aes(group=student), rescale=FALSE) + ylim(c(0, 100)) +
  facet_wrap(vars(student))

But coloring the chart by students is redundant since they are in separate panels already. So I tried to omit the group argument as below but failed.

ggRadar(x, aes(x=c(A, B, C, D, E)), rescale=FALSE) + ylim(c(0, 100)) + 
  facet_wrap(vars(student))

ERROR while rich displaying an object: Error: At least one layer must contain all faceting variables: `student`.
* Plot is missing `student`
* Layer 1 is missing `student`
* Layer 2 is missing `student`

Is it possible to use facet_ function without grouping individuals?

ADDED: also tried to use group aesthetics, but the groups are automatically colored.

ggRadar(x, aes(group=student), rescale=FALSE) + ylim(c(0, 100)) + 
  facet_wrap(vars(student))

kota7 avatar Nov 09 '19 12:11 kota7