문제

So I am attempting to create a dendrogram of 42 different genes based on a distance matrix. The figure was created with:

d6 = dist( t( cildata ) )

hc6 = hclust( d6 )

plot( hc6 )

I then just saved that plot as a jpeg.

I need to save a version of the plot with the gene names italicized, though, and am not sure how to go about doing that. I have seen similar questions relating to how to change main plot titles to italics, but not the labels inside the plot.

Any and all help is greatly appreciated.

Thanks, Marcus G.

도움이 되었습니까?

해결책

hc <- hclust(dist(USArrests), "ave")
italicLeafs <- c("Iowa", "New Hampshire") # select: italic leafs

den <- dendrapply(as.dendrogram(hc), FUN=function(n) {
  if(is.leaf(n)) 
    if (attr(n, "label") %in% italicLeafs) 
      attr(n, "label") <- as.expression(substitute(italic(leaf), list(leaf=attr(n, "label"))))
  n
})

plot(den)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top