[R] Error in plot.new() : figure margins too large

mlell08 mlell08 at gmail.com
Fri Jul 6 20:48:22 CEST 2012


On 06.07.2012 20:02, John Kane wrote:
> Your code works okay in a plan R terminal.  It may be an Rstudio problem or perhaps you already have a graphics device open and are trying to draw into it?
> 
> John Kane
> Kingston ON Canada
> 
> 
>> -----Original Message-----
>> From: kharrod at lbl.gov
>> Sent: Fri, 6 Jul 2012 10:39:41 -0700
>> To: r-help at r-project.org
>> Subject: [R] Error in plot.new() : figure margins too large
>>
>> Hello All,
>>
>> I am running the following code in RStudio, and I keep on getting an
>> error message that says:  "Error in plot.new() : figure margins too
>> large"
>> Is there something that I am doing wrong?
>>
>>
>> # Import Data
>> nba <- read.csv("http://datasets.flowingdata.com/ppg2008.csv", sep=",")
>> nba
>>
>> #Sort Data (sorting by Points, but could be sorting by any other
>> variable)
>> nba <- nba[order(nba$PTS),]
>>
>> #Prepare Data: makes rows by player name instead of Row Number
>> row.names(nba) <- nba$Name
>> #Prepare Data: don't need first column anymore, so we get rid of it
>> nba <- nba[,2:20]
>> #Prepe Data: change data from a data frame to a data matrix
>> nba_matrix <- data.matrix(nba)
>>
>> #Create Heat Map
>> nba_heatmap <- heatmap(nba_matrix, Rowv=NA, Colv=NA, col =
>> cm.colors(256), scale="column", margins=c(5,10))
>>
>>
>> Karly Harrod
>> LBNL Summer Intern
>> kharrod at lbl.gov
>> Lawrence Berkeley National Laboratory
>>
>>
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
> 
> ____________________________________________________________
> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
> 
> ______________________________________________
> 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.
> 

Hi,

try invoking dev.off() to make RStudio open up a new graphics device
with default settings.
If you have made the dimensions of the plotting area very small in
RStudio by dragging the bar between the left and the right area too far
on the right side, the area for drawing could be indeed too small to
draw a plot.
if this doesn't help either, check if you have set grphical parameters
to insane values (mar/mai, plt. fig/fin, oma/omd/omi, plt/pin)

if you can't find out anything, post the output of par()

Regards!

-- 
GnuPG Key: 0x7340821E



More information about the R-help mailing list