I am using facet to plot box plots. the facets are separated by 2 states, however, one of the x axis categories does not apply for one of the states. Since there is no data for that category. I do not want to show it at all in the plot. Is there a way to limit that? here is the code and data. Basically I don't want category "B" to be show for state NY.
Thanks,
CODEggplot(table, aes(x=Category, y=Value, fill=Category)) + geom_boxplot()+ facet_grid(.~ State)
DATA
| State |
Value |
Category |
| CA |
323 |
A |
| CA |
23 |
A |
| CA |
42 |
A |
| CA |
4 |
A |
| CA |
2 |
B |
| CA |
42 |
B |
| CA |
342 |
B |
| CA |
4 |
B |
| CA |
23 |
C |
| CA |
42 |
C |
| CA |
2 |
C |
| NY |
3 |
A |
| NY |
2 |
A |
| NY |
4 |
A |
| NY |
2 |
A |
| NY |
342 |
A |
| NY |
3 |
A |
| NY |
23 |
C |
| NY |
42 |
C |
| NY |
3 |
C |
| NY |
2 |
C |
| NY |
32 |
C |
| NY |
3 |
C |