[R] colors to pie chart.
petr.pikal at precheza.cz
Mon Feb 25 08:04:18 CET 2013
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Nicole Ford
> Sent: Monday, February 25, 2013 7:57 AM
> To: R help
> Subject: [R] colors to pie chart.
> hello, all.
> i am trying something new and am stuck. i typically go with whatever
> colors the pie function pops out, but i would like to customize it.
> please find below a sample dataset.
> ##TVs per household.
> TVs <- factor(c(rep("0", 1), rep("1", 16), rep("2", 14), rep("3", 12),
> rep("4", 3), rep("5", 2), rep("6", 2)))
> ##this runs just fine.
> ##however, when i add:
> colors <- c("cyan3","magenta","darkblue","darkmagenta","darkred",
> "darkgoldenrod1", "deeppink")
> ##and then:
> pie(table(TVs, col=colors))
> i receive this error.
> Error in table(TVs, col = colors) :
> all arguments must have the same length
> i have tried it a few different ways (changing color names, adding cex
> arguments, etc), with same results.
Did you try changing position of parentheses?
col is parameter for pie not for table.
> i am not sure why i would be getting this message if it works without
> the color functionality. i did a quick search which yielded nothing of
> thanks in advance.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help