[R] heatmap question

David Winsemius dwinsemius at comcast.net
Fri Jun 3 17:24:10 CEST 2011


On Jun 3, 2011, at 9:26 AM, Mark Aquino wrote:

> Yes I understand what ?<text> means, I meant is it possible to use  
> this function (as an argument) with heatmap.2,  but I learned I can  
> use add.expr=mtext(....) to do that.  However I'm not simply trying  
> to add more text to the graph but rather move the display of the x- 
> axis labels from the bottom of the chart to the top so the output  
> would be more like:
>
> 1 2 3 4 5 6
> --------------|1
> 		   |2
> 		   |3
> 		   |4
> 		   |5

The help page makes me think that repositioning the x-labels (which  
would also require repositioning or suppressing the "upper"  
dendrogram)  would require hacking the function, since it sets up  
specific regions on the page with layout(). You should provide a  
minimal example for other readers, but I'm not going to proceed  
further since it is now clear that you are not just trying to move the  
'xlab' which was how I interpreted your initial problem description.

[ Assuming you have suppressed the column dendrogram, it may be a  
simple as changing the 1 to 3 in this line of code:

  axis(1, 1:nc, labels = labCol, las = 2, line = -0.5, tick = 0,
         cex.axis = cexCol)
....]

-- 
David


>
> On Jun 2, 2011, at 10:45 PM, David Winsemius wrote:
>
>>
>> On Jun 2, 2011, at 10:42 PM, Mark Aquino wrote:
>>
>>> Hey David,
>>>
>>> Thanks for answering, but can I use mtext with the heatmap.2  
>>> function? According to the description that's not one of the  
>>> arguments it takes.
>>
>> It's not an argument. When someone types ?<something> it means to  
>> look at the help page for the <something> function which will  
>> appear if you just type ?<something> at the console.
>>
>>
>>> Sorry if these questions are trivial, I'm very new with R,  
>>> basically being forced to learn it for work.
>>>
>>>
>>> Best,
>>> Mark Aquino
>>> On Jun 2, 2011, at 10:37 PM, David Winsemius wrote:
>>>
>>>>
>>>> On Jun 2, 2011, at 4:08 PM, Mark Aquino wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have what would seem to be a very simple problem but have been  
>>>>> unable to find any way to go about solving it:
>>>>> I am using heatmap.2 to create a heatmap and by default the x  
>>>>> axis label is at the bottom of the heatmap, I simply want to  
>>>>> move the label to the top of the heatmap.
>>>>
>>>> ?mtext
>>>>
>>>>
>>>>> Any help with this would be greatly appreciated.
>>>>>
>>>>
>>>> -- 
>>>>
>>>> David Winsemius, MD
>>>> West Hartford, CT
>>>>
>>>
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list