1

This is a small portion of a vey big data

df<- structure(list(A = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0.68906, 0, 0, 0, 0, 0, 0, 0, 0, 0.13597, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0), B = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0.40001, 0, 0, 0, 0, 0.69718, 0, 0, 0, 0, 0, 0, 0, 
0, 0.090752, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), C = c(0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0.84068, 0, 0, 0, 0.34713, 0, 0, 0, 0, 0.65201, 
0, 0, 0.25725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
), D = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.86419, 0, 0, 0, 0.3845, 
0, 0, 0, 0, 0.67091, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0), E = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1.1083, 0.8324, 
0, 0, 0, 0.38499, 0, 0, 0, 0, 0.69064, 0, 0, 0.14596, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), F = c(0, 0, 0, 0, 0, 
0, 0, 0, 0, 1.0954, 0.74426, 0, 0, 0, 0.37715, 0, 0, 0, 0, 0.68884, 
0, 0, 0.20826, 0, 0.38782, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0), G = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1.0985, 0.66651, 0, 0, 
0, 0, 0, 0, 0, 0, 0.68861, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.1812, 
0, 0, 0, 0, 0, 0, 0, 0)), .Names = c("A", "B", "C", "D", "E", 
"F", "G"), class = "data.frame", row.names = c(NA, -39L))

What I want is to show the values in a more stressed way when there are a lot of zeros in a data

How I plot it is like this

eucl_dist=dist(df,method = 'euclidean')
hie_clust=hclust(eucl_dist,method = 'complete')
my_palette <- colorRampPalette(c( "green", "yellow", "red"))(n = 1000)
heatmap.2(mydata, scale = c("none"), Colv=F, Rowv=as.dendrogram(hie_clust), 
          xlab = "X", ylab = "Y", key=TRUE, keysize=1.1, trace="none", 
          density.info=c("none"), margins=c(4, 4), col=my_palette, dendrogram="row")

But as you see, in this small example, the zero dominate my plot and when it is very large then it is impossible to see anything. also I cannot change the position of the values

1 Answers1

1

You are asking a lot of questions here, I'll try to answer those I see.

Zero dominates plot

Zeros dominate you data but, what do the zeros mean? Without some insight into what the zeros actually mean its hard to prescribe one best way to deal with it.

Colormap

The colorful colormap that you chose is not the best way to describe quantitative data. I would suggest a simple white to blue (or color of your choice) so that your zeros are shown as white and get hidden with the nonzero data emphasized. Example (only changing my_palette <- colorRampPalette(c("white", "cornflowerblue"))(n = 1000)):

Example

Changing the position of the values

I'm not certain what you mean here but the layout is fixed by the dendrogram you defined.

vincentmajor
  • 1,076
  • 12
  • 20
  • thanks but when the data is over 1000000000 columns then it plots only a white plate. and the zero means there was no observation in my data (I cannot remove them but I can ignore them ) like NA or NaN or whatever. – user 127354 Dec 17 '16 at 19:41
  • What about removing rows that are entirely zero? In your example data, there were quite a few empty rows. That may reduce the number of rows so you can start to see the data. – vincentmajor Dec 18 '16 at 03:07
  • this is a small position of the biggest data, I will have at least few points in each line For sure. I found that one can use `facet_plot` do you know how to use it ? – user 127354 Dec 18 '16 at 10:25