Changing font size in the key in heatmap.2
1
0
Entering edit mode
5 months ago
Gerard ▴ 10

Hello,

Is there any way to change the font size of the x and y axis of the key histogram in heatmap.2?

Whenever I use cexCol and cexRow it only changes the font on the heatmap but not on the key

Thank you in advance

R heatmap heatmap.2 • 508 views
ADD COMMENT
0
Entering edit mode
5 months ago
BioinfGuru ★ 2.1k

From the docs

I think It will be a parameter added to key.par=list()

Possibly adding cex=, or cexCol= and cexRow= inside list()

 ## show how to customize the color key
 heatmap.2(x,
           key.par=list(mgp=c(1.5, 0.5, 0),
                        mar=c(2.5, 2.5, 1, 0),                               
                        cex=?????            # My insert, I think you can set your font size here
                        )
          )
ADD COMMENT
0
Entering edit mode

Thank you for your answer. When running this I get this error:

Error in.External.graphics(C_layout, num.rows, num.cols, mat, as.integer(num.figures),  : 
  Incorrect state of graphics

Any idea of where this comes from?

Thanks

ADD REPLY
0
Entering edit mode

I think this is an Rstudio error, not your code.

  1. I seem to remember getting some graphics errors when my plot window was too small in RStudio i.e. not enough pixels to plot the data.... not sure if it was this error though....the fix was just increase the window size (drag it) and re-run
  2. Take a look at this post. It has a few suggestions including increasing window size. Also, resetting the graphics device with dev.off()
ADD REPLY

Login before adding your answer.

Traffic: 1566 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