Long vertical colnames in gheatmap are cropped
0
0
Entering edit mode
4.1 years ago

Issues #158 and #371 are about the same, but these didn't seem to get any feedback. I hope my example can help with this issue.

I have plotted my tree, and next to it, my heatmap. My colnames are long and plotted in vertical. There seems to be limited space for printing these colnames, and it cannot be fixed by changing margins, or hjust, or offset

I will try with a simplified example:

My nwk tree :

((((((Dasyurus_hallucatus:6.42500000,(Dasyurus_viverrinus:5.67801667,Dasyurus_maculatus:5.67801667)'14':0.74698333)'13':0.69500000,Sarcophilus_harrisii:7.12000000)'11':50.05805636,(Isoodon_macrourus:25.20000000,Macrotis_lagotis:25.20000000)'10':31.97805636)'19':4.45095364,((Phascolarctos_cinereus:35.00972500,Lasiorhinus_latifrons:35.00972500)'9':13.93526577,(((Potorous_tridactylus:23.93946385,(((Macropus_rufogriseus:7.72000000,(Macropus_rufus:7.31500000,Macropus_giganteus:7.31500000)'22':0.40500000)'8':0.00000000,Wallabia_bicolor:7.72000000)'6':1.35000000,Dendrolagus_lumholtzi:9.07000000)'30':14.86946385)'29':23.65610282,(Trichosurus_vulpecula:4.03000000,Trichosurus_caninus:4.03000000)'27':43.56556667)'35':0.66887333,(Petaurus_norfolcensis:32.91610000,Pseudocheirus_peregrinus:32.91610000)'43':15.34834000)'42':0.68055077)'40':12.68401923)'48':96.96857758,Canis_lupus:158.59758758)'51':18.32991064,(Ornithorhynchus_anatinus:45.62328444,Tachyglossus_aculeatus:45.62328444)'47':131.30421377);

My metadata:

metadata.example<-structure(list(Genus_species.number1 = c("1", "0", "0", "1", "1", "0", "0", "0", "1", "0", "0", "1", "1", "1", "0", "1", "0", "0", "0", "1", "1"), Genus_species.number2 = c("0", "0", "0", "0", "1", "0", "0", "1", "1", "0", "0", "0", "0", "1", "1", "1", "0", "0", "0", "1", "0")), class = "data.frame", row.names = c("Canis_lupus", "Dasyurus_hallucatus", "Dasyurus_maculatus", "Dasyurus_viverrinus", "Dendrolagus_lumholtzi", "Macropus_giganteus", "Macropus_rufogriseus", "Macropus_rufus", "Macrotis_lagotis", "Ornithorhynchus_anatinus", "Petaurus_norfolcensis", "Phascolarctos_cinereus", "Potorous_tridactylus", "Pseudocheirus_peregrinus", "Sarcophilus_harrisii", "Tachyglossus_aculeatus", "Trichosurus_caninus", "Trichosurus_vulpecula", "Wallabia_bicolor", "Isoodon_macrourus", "Lasiorhinus_latifrons"))

My plot:

tree <- read.tree("tree.nwk")

p0<-ggtree(tree, size=0.5,layout="rectangular")+ geom_tiplab(size=3.5,offset = 0.5,align=F)+ theme(plot.margin=margin(1,1,50,0))+ geom_treescale(fontsize=3.5, linesize=0.5, offset=0.5)

gheatmap(p0, metadata.example, offset = 105, color="white", colnames_position="bottom", colnames_angle=90, colnames_offset_y = 0, hjust=1, font.size=3.5) + scale_fill_manual(values= c("grey90", "grey20"))

And this is my result:

enter image description here

#I haven't figured a way to make the colnames display in full. In my real plot I have many columns in the heatmap, so verticality is a must. Italization would be fantastic too :-) Thank you for help!

ggtree gheatmap • 668 views
ADD COMMENT

Login before adding your answer.

Traffic: 4083 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6