High resolution heatmap in r

I used the R list below and got a very nice heatmap :

 png( "test-8.png", width =800 , height =750 ) heatmap(1-cor(df),distfun=function(x){as.dist(x)},symm=F,Rowv=NULL, Colv=NULL) dev.off() 

But it was released with a fairly low resolution. After searching on Google, I found a possible solution:

 png( "test-8.png", width =800 , height =750,res=600 ) heatmap(1-cor(df),distfun=function(x){as.dist(x)},symm=F,Rowv=NULL, Colv=NULL) dev.off() 

Unfortunately, I received an error after executing the code:

 Error in par(op) : invalid value specified for graphical parameter "pin" Calls: heatmap -> par Execution halted 

How can i do this? Any suggestion would be appreciated.

+4
source share
2 answers

The parameters you set are likely to reduce the pin size below the minimum acceptable value (still looking for documentation on this). Try using the following. You may need to download the grid package to get the units argument.

 png("high_res.png", width = 4, height = 4, units = 'in', res = 600) heatmap(1-cor(df),distfun=function(x){as.dist(x)},symm=F,Rowv=NULL, Colv=NULL) dev.off() 
+2
source

I had the same problem and ran the following code,

 par() 

Many items are displayed. One of them is $ pin, which has two meanings. One was negative. I tried the following,

 par(pin=c(0,0)) 

It seems to have worked. I still don’t know what this means and why the error occurred.

0
source

All Articles