0

I reloaded some code I wrote a while again. I am trying to plot an individual raster from a raster stack, however keep encountering a problem with creating the first plot using plot.new. This is the error I am getting.

newras6< stack("/Users/jadedalpoimguedes/Desktop/data/kamiak/nick.maggio/JadeDAlpoim/PARALLEL/OUTPUT/MARCOTT/Barley_Alaska_120_125_Z_ETOPO5.tif")


newras6
# class       : RasterStack 
# dimensions  : 600, 59, 35400, 276  (nrow, ncol, ncell, nlayers)
# resolution  : 0.08333333, 0.08333333  (x, y)
# extent      : 120.0417, 124.9583, 10.04167, 60.04167  (xmin, xmax, ymin, ymax)
# coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
# names       : Barley_Al//Z_ETOPO5.1, Barley_Al//Z_ETOPO5.2, Barley_Al//Z_ETOPO5.3, Barley_Al//Z_ETOPO5.4, Barley_Al//Z_ETOPO5.5, Barley_Al//Z_ETOPO5.6, Barley_Al//Z_ETOPO5.7, Barley_Al//Z_ETOPO5.8, Barley_Al//Z_ETOPO5.9, Barley_Al//_ETOPO5.10, Barley_Al//_ETOPO5.11, Barley_Al//_ETOPO5.12, Barley_Al//_ETOPO5.13, Barley_Al//_ETOPO5.14, Barley_Al//_ETOPO5.15, ... 
# min values  :                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0,                     0, ... 
# max values  :                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535,                 65535, ... 


plot.new(newras6[[5]])

Error in plot.new(newras6[[5]]) : unused argument (newras6[[5]])

I have tried creating an object and plotting this, however am still getting the same error.

new<-newras5[[5]]

Error in plot.new(new) : unused argument (new)

This has not happened to me before.

Any suggestions on what may be wrong?

Richard Erickson
  • 2,568
  • 8
  • 26
  • 39
  • 3
    please provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – alexwhitworth Mar 01 '16 at 00:24
  • `str(newras6[[5]])` or `dput(newras6[[5]])` please. – MichaelChirico Mar 01 '16 at 00:26
  • 1
    does plot.new take an argument?? Do you just want plot? – user20650 Mar 01 '16 at 00:43
  • @user3315140; can you edit your question to add this info please – user20650 Mar 01 '16 at 00:47
  • @Alex Apologies I haven't used this forum so I'm not sure how to make this reproducible. – user3315140 Mar 01 '16 at 00:49
  • What is confusing me is that I ran the exact same code two weeks ago and it worked perfectly. – user3315140 Mar 01 '16 at 00:50
  • @user20650 It would be great if I could just plot directly, however I used to have to use plot.new before directly using plot. – user3315140 Mar 01 '16 at 00:51
  • Here is the full code I used: newras6 <-stack("/Users/jadedalpoimguedes/Desktop/data/kamiak/nick.maggio/JadeDAlpoim/PARALLEL/OUTPUT/MARCOTT/Barley_Alaska_120_125_Z_ETOPO5.tif") plot.new(newras6[[5]]) – user3315140 Mar 01 '16 at 00:51
  • `plot.new` takes no argument. See the help page. –  Mar 01 '16 at 01:00
  • @Pascal I read the help page for plot.new, however I do not understand. Am I feeding it an argument? I'm confused about why this worked before but is no longer working. – user3315140 Mar 01 '16 at 01:02
  • 3
    You are confused. That code did not work for you in the past. `plot.new()` does NOT take parameters. It is used to initialized a graphics device. When you called `plot.new(newras6[[5]])`, you got an informative error message: "Error in plot.new(newras6[[5]]) : unused argument (newras6[[5]])". – IRTFM Mar 01 '16 at 01:05
  • Oh ok! I get it! Thank you so much! – user3315140 Mar 01 '16 at 01:05

0 Answers0