Hi:

As Duncan noted, your approach is at best inefficient. Consider the
following example:

# Generate some fake data:
x <- data.frame(x = rpois(10, 5), y = rnorm(10))

# Generate a list where each component is a row of x
l <- split(x, rownames(x))
# verify it's a list
l
# class of each list component
sapply(l, class)

# the plot:
plot(y ~ x, data = do.call(rbind, l))

This works since each row of the list is a data frame with the same named
subcomponents. You haven't provided any information about the class of each
row of your list, but if it's data frame then the above should work. If they
are numeric vectors, the result of do.call() will be a matrix, so you may
have to wrap as.data.frame() around the do.call(). If it's something else,
then you may have to do some work to get the right input form for plot().

HTH,
Dennis

On Mon, Jul 19, 2010 at 2:47 PM, math_daddy <math_daddy@hotmail.com> wrote:

>
> I have a list of vectors of length 2, each representing a point in 2-space,
> and each of which I wish to plot on the current plot.
> In a loop, I assign the x and y coordinates of the current element of the
> list to variables 'x' and 'y' respectively, then make a call to plot as
> follows:
>
> par(new = TRUE)
> plot(x,y, xlim = c(0,1),ylim=c(0,1), xlab <- "x", ylab <- "y",type =
> "p",log="")
>
> I must specify the input variable 'type', even though it defaults to "p",
> because the previous call to plot() was used to plot lines, and so type is
> set to "l".
> However, it is not clear to me why I must specify 'log'. It should still be
> equal to "" since it was not changed in any previous call to plot(), but if
> I do not specify it as above I get (4 of) the following message:
>
> Warning messages:
> 1: In plot.window(...) :
>  nonfinite axis limits [GScale(-inf,0,1, .); log=1
>
> I would like to know the reason for this. Also, if my variables are named
> anything other than 'x' and 'y', the x and y axes are not labeled according
> to the xlab and ylab values I set in my call to plot. Why is this?
>
> Thank you very much.
> --
> View this message in context:
> http://r.789695.n4.nabble.com/problems-with-plot-tp2294663p2294663.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

