Changing heatmap ticks from numbers to months in R

55

The values printed on the axes are determined by the row and column names of the object you pass in. There is a built in vector of month abbreviations that you can use. Try

rownames(data) <- month.abb

Or you could set the values to whatever you like.

Share:
55
Sad Vaseb
Author by

Sad Vaseb

Updated on December 22, 2022

Comments

  • Sad Vaseb
    Sad Vaseb over 1 year

    I have heatmap with month number on the y-axis. I want to change the numbers to month name (e.g., "Jan.","Feb.","Mar.","Apr."). Here is the heatmap

    enter image description here

    and this is my code:

    heatmap(data, Rowv=NA, Colv=NA, margins=c(3,3),
                       col = magma(50), scale="none", xlab = "Hours",
                       ylab = "Month")
    
    • Kris Gruttemeyer
      Kris Gruttemeyer over 9 years
      Can you determine if the SQL server is under CPU pressure? As a DBA, I've seen some crazy queries load up our CPUs and bring the system to a halt. At least from a DBA's perspective, I'd try to rule each application out, one at a time. Also, check and make sure the SQL server 'Priority Boost' option is NOT checked.
    • Zoredache
      Zoredache over 9 years
      what can be done to stop it from doing so? Throw more hardware at it so that it isn't under heavy load.
    • Kris Gruttemeyer
      Kris Gruttemeyer over 9 years
      So, instead of trying to deduce the exact problem and, potentially fix an issue that could get worse and cause more issues, you just want to throw more hardware at it? Some companies don't have the ability to just or won't do so until all other options are exhausted. I don't subscribe to the 'add more hardware' mentality as it simply treats the symptoms, not the underlying problems. Perfect example is if SQL server priority boost was enabled, adding more CPU would alleviate the symptoms but wouldn't actually fix the problem.
    • Oskar Berggren
      Oskar Berggren over 9 years
      @KrisGruttemeyer "Boost SQL Server priority" is turned off.
    • Sad Vaseb
      Sad Vaseb over 3 years
      @MrFlick it worked :) Your way was interesting!