What is plot.new? and how can i get it to work so i can load other data?> library(splancs) > area = 6*4 > lambda = 1.5 > N = rpois(1,lambda*area) > u = runif(N,-2,4) > v = runif(N,0,4) > plot(u,v,asp=1) > h = chull(u,v) > h = c(h,h[1]) > plot(u[h],v[h],"1",asp=1)Error in plot.xy(xy, type, ...) : invalid plot type '1'> plot(u[h],v[h],"l",asp=1) > points(u,v)Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet> pts=as.points(u,v) > pointmap(pts) > hullpoly=as.points(u[h],v[h]) > polymap(hullpolly,add=TRUE)Error in xy.coords(x, y) : object 'hullpolly' not found> help(polymap) > help(plot.net)No documentation for 'plot.net' in specified packages and libraries: you could try '??plot.net'> help(plot.new) > plot(u[h],v[h],"l",asp=1) > plot.new(u,v)Error in plot.new(u, v) : unused argument(s) (u, v)> plot.new() > points(u,v)Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet> plot.new(u,v)Error in plot.new(u, v) : unused argument(s) (u, v)> plot.new(xy.coords(x,y))Error in plot.new(xy.coords(x, y)) : unused argument(s) (xy.coords(x, y))> plot.new(uv.coords(u,v))Error in plot.new(uv.coords(u, v)) : unused argument(s) (uv.coords(u, v))> plot.new <- function()+ {}> { }NULL> plot.new <- function()+ { }> { }NULL> { for }Error: unexpected '}' in "{ for }"> area = 60*20 > lambda = 2 > N = rpois(1,lambda*area) > u = runif(N,20,40) > v = runif(N,-10,10) > plot(u,v,asp=1) > > plot(u,v,asp=1) > u = runif(N,20,40) > v = runif(N,-10,10) > plot(u,v,asp=1) > > plot(u,v,asp=1) > u = runif(N,20,40) > v = runif(N,-10,10) > plot(u,v,asp=1) > u = runif(N,20,40) > v = runif(N,-10,10) > plot(u,v,asp=1) > h = chull(u,v) > h = c(h,h[1]) > plot(u[h],v[h],"l",asp=1) > points(u,v)Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet> pts=as.points(u,v) > pointmap(pts) > hullpoly=as.points(u[h],v[h]) > polymap(hullpolly,add=TRUE)Error in xy.coords(x, y) : object 'hullpolly' not found No help files found matching ?hullpoly? using fuzzy matching> pointmap(as.points(hullpoly), add=TRUE)Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet> hullpoly=as.points(u[h],v[h]) > polymap(hullpoly$poly, add=TRUE)Error in hullpoly$poly : $ operator is invalid for atomic vectors> polymap(hullpoly,add=TRUE)Error in polygon(poly, ...) : plot.new has not been called yet> plot.new()NULL> par(new=TRUE)Warning message: In par(new = TRUE) : calling par(new=TRUE) with no plot> plot.new()NULL> par(new=TRUE)Warning message: In par(new = TRUE) : calling par(new=TRUE) with no plot> new.u=runif(50,20,40) > new.v=ruinf(50,-10,10)Error: could not find function "ruinf"> new.v=runif(50,-10,10) > pts.in=pip(as.points(new.u,new.v),hullpoly,out=FALSE) > pointmap(pts.in,col="red",add=TRUE)Error in plot.xy(xy.coords(x, y), type = type, ...) : plot.new has not been called yet
Please start R and enter the following commands: library(splancs) area = 6*4 lambda = 1.5 N = rpois(1,lambda*area) u = runif(N,-2,4) v = runif(N,0,4) h = chull(u,v) h = c(h,h[1]) plot(u[h],v[h],"l",asp=1) points(u,v) If you do not get the plot you're expecting, then repost 1) adding an informative subject line 2) showing us what you tried without including your typos and other errors. I think you'll find this a more effective strategy than trying to replace core elements of R that you don't understand with empty functions. - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spector at stat.berkeley.edu On Mon, 21 Feb 2011, Schmidt, Lindsey C (MU-Student) wrote:> What is plot.new? and how can i get it to work so i can load other data? > >> library(splancs) >> area = 6*4 >> lambda = 1.5 >> N = rpois(1,lambda*area) >> u = runif(N,-2,4) >> v = runif(N,0,4) >> plot(u,v,asp=1) >> h = chull(u,v) >> h = c(h,h[1]) >> plot(u[h],v[h],"1",asp=1) > Error in plot.xy(xy, type, ...) : invalid plot type '1' >> plot(u[h],v[h],"l",asp=1) >> points(u,v) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet >> pts=as.points(u,v) >> pointmap(pts) >> hullpoly=as.points(u[h],v[h]) >> polymap(hullpolly,add=TRUE) > Error in xy.coords(x, y) : object 'hullpolly' not found >> help(polymap) >> help(plot.net) > No documentation for 'plot.net' in specified packages and libraries: > you could try '??plot.net' >> help(plot.new) >> plot(u[h],v[h],"l",asp=1) >> plot.new(u,v) > Error in plot.new(u, v) : unused argument(s) (u, v) >> plot.new() >> points(u,v) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet >> plot.new(u,v) > Error in plot.new(u, v) : unused argument(s) (u, v) >> plot.new(xy.coords(x,y)) > Error in plot.new(xy.coords(x, y)) : unused argument(s) (xy.coords(x, y)) >> plot.new(uv.coords(u,v)) > Error in plot.new(uv.coords(u, v)) : unused argument(s) (uv.coords(u, v)) >> plot.new <- function() > + {} >> { } > NULL >> plot.new <- function() > + { } >> { } > NULL >> { for } > Error: unexpected '}' in "{ for }" >> area = 60*20 >> lambda = 2 >> N = rpois(1,lambda*area) >> u = runif(N,20,40) >> v = runif(N,-10,10) >> plot(u,v,asp=1) >> >> plot(u,v,asp=1) >> u = runif(N,20,40) >> v = runif(N,-10,10) >> plot(u,v,asp=1) >> >> plot(u,v,asp=1) >> u = runif(N,20,40) >> v = runif(N,-10,10) >> plot(u,v,asp=1) >> u = runif(N,20,40) >> v = runif(N,-10,10) >> plot(u,v,asp=1) >> h = chull(u,v) >> h = c(h,h[1]) >> plot(u[h],v[h],"l",asp=1) >> points(u,v) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet >> pts=as.points(u,v) >> pointmap(pts) >> hullpoly=as.points(u[h],v[h]) >> polymap(hullpolly,add=TRUE) > Error in xy.coords(x, y) : object 'hullpolly' not found > No help files found matching ?hullpoly? using fuzzy matching >> pointmap(as.points(hullpoly), add=TRUE) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet >> hullpoly=as.points(u[h],v[h]) >> polymap(hullpoly$poly, add=TRUE) > Error in hullpoly$poly : $ operator is invalid for atomic vectors >> polymap(hullpoly,add=TRUE) > Error in polygon(poly, ...) : plot.new has not been called yet >> plot.new() > NULL >> par(new=TRUE) > Warning message: > In par(new = TRUE) : calling par(new=TRUE) with no plot >> plot.new() > NULL >> par(new=TRUE) > Warning message: > In par(new = TRUE) : calling par(new=TRUE) with no plot >> new.u=runif(50,20,40) >> new.v=ruinf(50,-10,10) > Error: could not find function "ruinf" >> new.v=runif(50,-10,10) >> pts.in=pip(as.points(new.u,new.v),hullpoly,out=FALSE) >> pointmap(pts.in,col="red",add=TRUE) > Error in plot.xy(xy.coords(x, y), type = type, ...) : > plot.new has not been called yet > ______________________________________________ > 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. >
On 02/22/2011 03:31 AM, Schmidt, Lindsey C (MU-Student) wrote:> What is plot.new? and how can i get it to work so i can load other data? >Hi Lindsey, It looks to me as though spelling mistakes in your code are causing failures to generate some of the objects that you then pass to "plot". The plot command fails because it can't find one of the objects. When you then ask for an enhancement to the plot that doesn't exist, you get the "plot.new" error. For instance: # something wrong with the creation of "hullpoly" > hullpoly=as.points(u[h],v[h]) ... Error in xy.coords(x, y) : object 'hullpolly' not found # this fails to create "new.v" (should be "runif") > new.v=ruinf(50,-10,10) Error: could not find function "ruinf" When you have a string of plot commands that depend upon the creation of some initial variable, if that variable doesn't get created, they will all fail, setting you up for the "plot.new" error which is complaining about the absence of one or more plots that weren't displayed in the first place. Jim
Seemingly Similar Threads
- (no subject)
- par(las = 1) not possible in polymap(), library(splancs)?
- Question:manipulating spatial data using combination of Maptools and Splancs
- Fine Tuning Country Map
- Warning messages in Splancs package :: no non-missing arguments to min; returning Inf