3

I try to to change the colors of a contingency plot in R that is created with the survey package. Unfortunately only the colors of the rows from the contingency table are changed. Is there a way to give each of the four fields below an individual color?

Here is what I tried:

library("survey")
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
plot(svytable(~sch.wide+comp.imp,design=dstrat),
     color=c("red","blue","green","black"))

Contingency Plot with survey package

joaoal
  • 1,892
  • 4
  • 19
  • 29
  • 1
    This plot is actually from `graphics:::plot.table` and isn't a `survey` specific plot. – zacdav May 23 '18 at 07:38
  • @zacdav Just out of curiosity: how did you find out which method gets deployed? It seems that the table in question is of type `svytable`. Been wondering how to trace down which `plot.___` is actually working... – coffeinjunky May 23 '18 at 07:52
  • 1
    @coffeinjunky so i looked at the classes of the object being provided to `plot()` and then checked if they returned anything from `methods("plot")`. Then just manually tried the methods to see what produced the same plot. You can probably use a profiling tool to see it as well. – zacdav May 23 '18 at 22:01

0 Answers0