0

Henlo internet. Having trouble with ggplotly rendering of a heatmap generated in ggplot2. It cuts off the first few lines of the plot for some reason.

Here are the first few lines of the dataframe:

           Gene                                        Swissprot       tab condition foldchange
1 Xvis03_203700         Bidirectional sugar transporter SWEET16  transport    NST_75        6.8
2 Xvis03_205865                                    DPH3 homolog  transport    NST_75        1.9
3 Xvis03_201037       DUF21 domain_containing protein At4g14240  transport    NST_75        0.7
4 Xvis03_217938                   Vacuolar iron transporter 1.2  transport    NST_75        6.9
5 Xvis03_225321                   Copper transport protein ATX1  transport    NST_75        1.0
6 Xvis03_200929  Copper_transporting ATPase PAA1, chloroplastic  transport    NST_75        2.5

Here is my code:

library(wesanderson)
pal <- wes_palette("Zissou1", 20, type = "continuous")
level_order <- factor(heat_trans$condition, levels = c("NST_75", "NST_55", "NST_35", "NST_AD", "NST_RH", 
                 "PST_75", "PST_55", "PST_35", "PST_AD", "PST_RH",
                 "ST_FT","ST_75", "ST_55", "ST_35", "ST_AD", "ST_RH"))

trans.heatmap <- 
  ggplot(heat_trans) +
  geom_tile(aes(x = level_order, y = Swissprot, fill = foldchange)) +
  scale_fill_gradientn(colours = pal, na.value = "grey50")+
  ggtitle("Desiccome Transport Genes")+
  theme(axis.text.x = element_text(angle=90),
        plot.background = element_rect(colour = "white"),
        axis.ticks = element_blank(),
        axis.title = element_blank())
trans.heatmap #for ggplot version
ggplotly(trans.heatmap, tooltip = c("Swissprot", "foldchange")) #for ggplotly version

This is the ggplot version of the heatmap: This is the ggplot version of the heatmap

This is the ggplotly version of the heatmap: This is the ggplotly version of the heatmap

This is the ggplotly version zoomed out to demonstrate that zooming is not the issue: This is the ggplotly version zoomed out to demonstrate that zooming is not the issue

Thanks for any help and advice!

kath
  • 7,624
  • 17
  • 32

1 Answers1

0

LOL Rookie error - there were duplicate values in the Swissprot column. Cringe.