I was using the function below to create a heatmap from a matrix of 48 columns X 32 rows:
heatmap.2(all.data,Rowv = FALSE, Colv = FALSE, trace="none",main="All data",col=colorRampPalette(c("green","yellow","red")))
It was giving me some warnings because of the removal of the dendograms, but still it gave me the heatmap I wanted plus the color key, something happend and now when I try to run the same it gives me the plot without the color key and an error:
Error in plot.new() : figure margins too large
In addition: Warning messages:
1: In heatmap.2(all.data, Rowv = FALSE, Colv = FALSE, trace = "none", :
Discrepancy: Rowv is FALSE, while dendrogram is `both'. Omitting row dendogram.
2: In heatmap.2(all.data, Rowv = FALSE, Colv = FALSE, trace = "none", :
Discrepancy: Colv is FALSE, while dendrogram is `none'. Omitting column dendogram.
if I change the margins to 1 for all sides:
par(mar=c(1,1,1,1))
heatmap.2(all.data,Rowv = FALSE, Colv = FALSE, trace="none",main="All data",col=colorRampPalette(c("green","yellow","red")))
and try again it doesn't make the heatmap and gives me this error:
Error in .External.graphics(C_layout, num.rows, num.cols, mat, as.integer(num.figures), :
invalid graphics state
In addition: Warning messages:
1: In heatmap.2(all.data, Rowv = FALSE, Colv = FALSE, trace = "none", :
Discrepancy: Rowv is FALSE, while dendrogram is `both'. Omitting row dendogram.
2: In heatmap.2(all.data, Rowv = FALSE, Colv = FALSE, trace = "none", :
Discrepancy: Colv is FALSE, while dendrogram is `none'. Omitting column dendogram.
I also tried adding to the function key=T, but the color key is still not appearing in the Heatmap, any help will be very much appreciated!!!
If your plot has been working in the past and is now throwing the invalid graphics state
error, try resetting the graphics device by calling dev.off()
. This was suggested by RStudio's help site.