how to get a readable scale on a particular R plot
Hello,
I'm having difficulties to get a plot with a readable scale.
I have plotted transcriptomic data using R with package EMA. However 'genes names' (ordinate axis) are written too big and I can't see all gene names. I would like to have one gene name per compartment.
Here is my code:
clustering.plot(tree= c.sample, tree.sup=c.gene, data=tpm.100,
dendro=TRUE, dendro.sup=TRUE, names=TRUE, names.sup=TRUE, names.dist=TRUE, trim.heatmap=0.99)
clustering.plot(tree= c.sample, tree.sup=c.gene, data=tpm.100,
legend=FALSE, legend.pos="bottomright",
dendro=FALSE, dendro.sup=FALSE,names.sup=TRUE, names.dist=TRUE,trim.heatmap=0.99)
I have read EMA package documentation to play with different options without success.
I'm new with R, there should be some obvious things i'm missing
Thank you for your help
• 2,443 views
•
link
1 answer
It was recommanded to me to use pheatmap package (https://stackoverflow.com/questions/63225729/how-to-get-a-readable-scale-on-a-particular-r-plot)
Here is what I get:
install.packages("pheatmap")
library(pheatmap)
# load data and subset
data=read.table("/Users/vmicrobio/Desktop/tpm.100.txt",sep="\t",header=TRUE,row.names = 1 )
head(data)
# data.matrix()
data_subset <- as.matrix((data), threshold = 10, p=0.2)
tpm=data.frame(data_subset)
tpm.log <- log2(tpm[,]+1)
# normalization
cal_z_score <- function(x){
(x - mean(x)) / sd(x)
}
tpm.log_norm <- t(apply(tpm.log, 1, cal_z_score))
# heatmap
pheatmap(tpm.log_norm, main="test norm", fontsize_row=6, filename="/Users/vmicrobio/Desktop/heatmap_test.pdf")

• 0 views
•
link
Log in to answer this question.
what is the size of
tpm.100? can you try removingtrim.heatmapfunction in the code?thank you for your comment.
tmp.100is a 15x87 table (including one line and one column of headers). Withouttrim.heatmapI get the same graph.