[R] About "Plot.new"

Adam D. I. Kramer adik-rhelp at ilovebacon.org
Fri Sep 12 00:50:28 CEST 2008


You can't add=TRUE unless the graph exists in the first place. So, drop that
if you're creating the graph. Or if that's there because you want to put a
boxplot on top of a preexisting graph, make sure you have created the
preexisting graph already.

--Adam

On Thu, 11 Sep 2008, cathelf wrote:

>
> Hi, sorry for bothering your guys.
> I will trying to make some nice graph using boxplot. when I check the help
> file of boxplot, there is a sample code as:
>
> boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
>             boxwex = 0.25, at = 1:3 + 0.2,
>             subset = supp == "OJ", col = "orange")
>     legend(2, 9, c("Ascorbic acid", "Orange juice"),
>            fill = c("yellow", "orange"))
>
> But when I run it, it shows the following error:
> Error in xypolygon(xx, yy, lty = "blank", col = boxfill[i]) :
>        plot.new has not been called yet
>
>
> what does it mean? If  I first run "plot.new()", then running the above
> code, only the x-axis and y-axis is on the graph, no boxplot inside.
>
> Can anyone tell me how to call  plot.new or at least how to run the above
> code correctly?
>
> Thank you very much!
>
>
> -- 
> View this message in context: http://www.nabble.com/About-%22Plot.new%22-tp19446258p19446258.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list