This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Row and coloumn names do not display on x and Y axis in heatmaply.

Row and coloumn names do not display on x and Y axis in heatmaply. Instead of row and colomn names it is showing digits.

data <- read.csv("/Users/apple/Documents/42_heatmap_new.csv", sep=",")
> rnames <- data[,1]
> mat_data <- data.matrix(data[,2:ncol(data)]) ## matrix started with second column
> heatmaply(mat_data, file="heatmaply_preformed.html", dendrogram = "none", plot_method= c("plotly"), margins = c(150,250,30,150), grid_gap = 0.1, show_grid = TRUE, xlab = "Antibiotics", ylab = "Clinical isolates", main="Heatmap for drug resistance profile of 42 complete genomes", cexCol = 0.9, cexRow = 1.0, lwid =c(4,1), lhei =c(2,2))
heatmap

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

code seems to have no problem. x and y axis (xlab and ylab) names are present in output as expected. I hope you have installed phantom js via R (install via webshot::install_phantomjs()). Then add following information to your code: file = c("heatmaply_plot.html", "heatmaply_plot.png"). This should create a png file in working directory. If it has xlab and ylab, then your displaying window has issue.

But my code do not display all the anitbiotic names at the x axis and isolates names at y axis instead it is showing numbers like 1, 2, 3 , 4 and so on. What to do.

1 answer

Well, title of your post is misleading. Add labRow =rnames, labCol = colnames(data[,-1] to your code at the end. First add only `labRow =rnames' to your code. See if it works. If it works, then add labcol. If it doesn't, please post example data.

wow labRow =rnames works. but labCol = colnames(data[,-1] still does not work. Do not display coloumn names. Is there any other solution.

what is the output of names(data[,2:ncol(data)])?

Shwoing all antibiotics names like [1] "Amikacin" "Gentamicin"
[3] "Streptomycin" "Spectinomycin"

colnames(data[,-1] ) should work. It is same as names(data[,2:ncol(data)])

Log in to answer this question.