Error in .External.graphics & figure margins too large

heatmap, r

Solution

Figured it out; it was just a mistake with the display. If I automatically save the plot instead of asking RStudio to show it to me, the graph is ok

Problem

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. How to resolve this?

Original source