From p.murrell at auckland.ac.nz  Wed Jun  9 03:41:53 2010
From: p.murrell at auckland.ac.nz (Paul Murrell)
Date: Wed, 09 Jun 2010 13:41:53 +1200
Subject: [Rd] [R] textbox in lattice
In-Reply-To: <AANLkTilBqkTawxTbLly5NmBptBlug0UwM4AV7LjYDc6D@mail.gmail.com>
References: <4C05454A.3040508@smartmediacorp.com>	<AANLkTik5SP9nnMIhcUltpvjD9J_2blBgdDDMr247ixSP@mail.gmail.com>	<4C0556DC.2000304@smartmediacorp.com>	<AANLkTinMan1_OSEouH9wvR97tyeJuvdp3yf-UH9jHnom@mail.gmail.com>	<AANLkTinaicABAVUxytuocd5nZHHKYKlkE4g5cHOG5wyY@mail.gmail.com>	<AANLkTin_J-kVmF8Wta9cPSh9bmtJflRoyWCnA-iz3bha@mail.gmail.com>	<4C0720C8.1070102@auckland.ac.nz>	<AANLkTile2Lx-PRzCtMSZMIlW_KUIR2g74dSmAeyV-Tsj@mail.gmail.com>
	<AANLkTilBqkTawxTbLly5NmBptBlug0UwM4AV7LjYDc6D@mail.gmail.com>
Message-ID: <4C0EF161.9080700@auckland.ac.nz>

Hi

On 6/6/2010 11:20 PM, baptiste auguie wrote:
> Hi,
>
> I've just added width/heightDetails methods following Paul's
> suggestion. I kept a duplicate of all on-the-fly grob size
> calculations; it is necessary to ensure that the table cells adjust to
> the content which can be subsequently edited (e.g changing the
> colnames to plotmath expressions). Drawing the full iris dataset (150
> x 5) takes 12 seconds when it was 8 seconds before. It is still
> reasonable; I don't think anyone would want to use it for huge tables
> anyway.
>
> Out of curiosity, could drawDetails and height/widthDetails be altered
> to share some information (thereby avoiding such duplication of
> calculations at drawing time), or do they have to be completely
> independent in the implementation?

In theory, you could cache information from drawing (such as where on 
the device you drew), but this would have to be updated if the device is 
resized (or output is copied between devices) and there is no general 
infrastructure to support that at the moment.

PLUS width/height calculations can be performed independently of 
drawing.  I might want to position some output based on where a grob 
WOULD be drawn, but without actually drawing the grob.  So it would not 
be safe, for example, for widthDetails() to assume that drawDetails() 
had previously been called.

These are not insurmountable problems;  they are just examples to show 
that the implementation would be non-trivial.

Paul

> Best,
>
> baptiste
>
> On 3 June 2010 07:58, baptiste auguie<baptiste.auguie at googlemail.com>  wrote:
>> Hi,
>>
>> On 3 June 2010 05:26, Paul Murrell<p.murrell at auckland.ac.nz>  wrote:
>>
>>> Or the same drawing calculations have to be repeated within
>>> width/heightDetails - those methods should get run within the same graphical
>>> context as the drawDetails method.
>>>
>>
>> Yes, the idea crossed my mind, but I did not find it very appealing
>> (already the function is slower than it could/should be). Something to
>> consider though, in a future version.
>>
>> Thanks,
>>
>> baptiste
>>
>>
>>
>>
>>
>>> Paul
>>>
>>>> Best,
>>>>
>>>> baptiste
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> 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
>>> Auckland
>>> New Zealand
>>> 64 9 3737599 x85392
>>> paul at stat.auckland.ac.nz
>>> http://www.stat.auckland.ac.nz/~paul/
>>>
>>

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



[Rd] [R] textbox in lattice
Paul Murrell