Search code examples
rplotlattice

plotting issue on R (using heatmaps)


I have a matrix to plot and I am using the following lines:

library(lattice)
levelplot(cont.freq)

I want to get rid of the black things in the plot? I would like to use rownames and colnames of the matrix for x&y labeling. However I don't know how to represent them in a nice way.

By the way, matrix is 1284x1284..

enter image description here


Solution

  • Following works:

    x_at <- pretty(seq_len(nrow(cont.freq)))
    y_at <- pretty(seq_len(ncol(cont.freq)))
    levelplot(cont.freq, rm.na = TRUE, scales=list(y=list(at=y_at),x=list(at=x_at)), xlab="Residue ID", ylab="Residue ID", main="Contact Frequency")