1

Follow up Heatmap question Creating a heatmap / ordering columns for yearly data in R

Heatmaply

Heatmaply2

  1. The rownames change but my data does not change with this, can I ask for any help on how to have each respective row of data move with it's name?

  2. Is there an easier way to make the graph / png wider as I have been messing around with the margins and all I seem to do is make it narrower.

  3. I've attached a second image to show when I highlight a particular cell e.g. Skin Diseases in Jan a different value to what is in the .csv file, is this right? (Seeing as the colors match up should I just run with it?)

    library(heatmaply) x <-read.csv("Heatmap.csv", check.names = FALSE)

    rownames(x) <- c('All Others', 'Circulatory Diseases', 'Digestive Diseases', 'Ear Diseases', 'Endocrine/Metabolic','Eye Diseases', 'Genitourinary Diseases', 'Ill-defined Condition', 'Infectious & Parasitic', 'Injury/ Poisoning', 'Mental & Behavioural', 'Musculoskeletal', 'Neoplasms', 'Nervous System', 'Pregnancy/Childbirth', 'Respiratory', 'Skin Diseases')
    
    x <- x[,2:13, drop=FALSE]
    x <- as.matrix(scale(x))
    
    heatmaply(x,colors = heat.colors(200), k_col =1, k_row = 2, dendrogram = FALSE, margins = c(100, 160), 
          scale_fill_gradient_fun = ggplot2::scale_fill_gradient2(low = "blue", high = "red", midpoint = 50, limits = c(0, 100)))
    
S Rivero
  • 708
  • 5
  • 14
JimJanes
  • 33
  • 6
  • 3
    It's best to ask one question at a time because you an accept at most one answer. Also, make sure your post is self contained and includes a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – MrFlick Jun 29 '17 at 14:42
  • Please follow @MrFlick so that people could answer your question. – Tal Galili Jun 30 '17 at 12:33

0 Answers0