Skip to content
Back to formatted view

Raw Message

Message-ID: <61627C21-B2EA-44BF-9DC2-B8B5D0323736@imidex.com>
Date: 2011-01-12T00:01:23Z
From: Richard Vlasimsky
Subject: Problems creating a PNG file for a dendrogram: "Error in plot.window(...) : need finite 'xlim' values"

Has anyone successfully created a PNG file for a dendrogram?

I am able to successfully launch and view a dendrogram in Quartz.  However, the dendrogram is quite large (too large to read on a computer screen), so I am trying to save it to a file (1000x4000 pixels) for viewing in other apps.  However, whenever I try to initiate a PNG device, I get a "need finitite 'xlim' values" error. 



Here is some example code to illustrate my point:

cor.matrix <- cor(mydata,method="pearson",use="pairwise.complete.obs");
distance <- as.dist(1.0-cor.matrix);
hc <- hclust(distance);
p <- plot(hc);
plot(p);
#This works!  Plot is generated in quartz no problem.


#Now, try this:
png(filename="delme.png",width=4000,height=1000);
cor.matrix <- cor(mydata,method="pearson",use="pairwise.complete.obs");
distance <- as.dist(1.0-cor.matrix);
hc <- hclust(distance);
p <- plot(hc);
plot(p);
#Error in plot.window(...) : need finite 'xlim' values
#In addition: Warning messages:
#1: In min(x) : no non-missing arguments to min; returning Inf
#2: In max(x) : no non-missing arguments to max; returning -Inf
#3: In min(x) : no non-missing arguments to min; returning Inf
#4: In max(x) : no non-missing arguments to max; returning -Inf 

This is the exact same code, only a prior call to png() causes the seemingly unrelated xlim to fail.  Why is this?

Thanks,
Richard Vlasimsky