[R] figure-definition and heatmap question
paul at stat.auckland.ac.nz
Fri Aug 24 13:55:51 CEST 2007
> Hi Paul,
> > You are getting the error because you are setting the figure region to
> > be larger than the current device (typically 6 or 7 inches wide/high).
> > You SHOULD be getting the error when you try par(fin), BUT there is a
> > check missing in the C code, so what happens is that heatmap saves your
> > par settings and then tries to reset them (this is where par(op) comes
> > from), and because it saves BOTH par(fig) and par(fin) it resets both of
> > them, and when it resets par(fig) there IS a check on the values, the
> > values are larger than the current device and you get the error. Now,
> > because there is an error in resetting par(fig), that parameter is not
> > reset, so when you type par()$fin (or, equivalently, par("fin")) after
> > the heatmap() call, you get the last setting that heatmap() did, which
> > was from a layout inside heatmap, and so par("fig") is NOT what you set.
> > Finally, there is no point in setting par(fig) before heatmap() because
> > heatmap() is one of those functions that takes over the whole device
> > anyway, so your par(fig), even if it was valid, would have no effect.
> > If you want to make the heatmap() plot take up less of the page, you
> > could set outer margins (see par(oma)), e.g., ...
> > par(oma=rep(4, 4))
> > heatmap(x, Rowv = NA, Colv = NA, scale="none", col=cp(200))
> thank you very much for the explanation. Now I understand at least the strange
> fig/fin values ;) There is only one question left:
>> If you want to make sure that each position in the heatmap is square, DO
>> NOTHING, because the layout that heatmap() sets up is using "respect" so
>> the image will be square no matter what you do.
> Okay, for the example, I've chosen it might be true. My initial reason to try
> to force it to squares has been the visualization of matrix which is not
> quadratic (e.g. 12x8). In this case heatmap stretches the coloured areas to
> rectangles. I planned to set the figure region with the same length/width ratio
> as the matrix is to get squares...
> If I understood everything now, I have to think about something else than
> heatmap to make sure to get squares, right?
The original heatmap() author may need to confirm this, but from my look
at the code, yes.
> Thanks, Jim, I'll test this method for my purpose :)
>>>> And another question concerning the heatmap: May I force the funtion
>>>> to plot A1 at the upper left corner instead of the lower left?
>>>> I'll be glad about any idea how to solve these problems...
>>>> R-help at stat.math.ethz.ch mailing list
>>>> PLEASE do read the posting guide
>>>> and provide commented, minimal, self-contained, reproducible code.
>>> R-help at stat.math.ethz.ch mailing list
>>> PLEASE do read the posting guide
>>> and provide commented, minimal, self-contained, reproducible code.
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
64 9 3737599 x85392
paul at stat.auckland.ac.nz
More information about the R-help