[Rd] Converting width for a grob where graphics parameters have length 0 crashes R

Paul Murrell p@u| @end|ng |rom @t@t@@uck|@nd@@c@nz
Tue Nov 16 07:54:42 CET 2021


Hi

There is now a fix for this problem in r-devel (r81197).

Thanks for reporting the problem!

Paul

On 15/11/2021 9:16 am, Paul Murrell wrote:
> Hi
> 
> Thanks for bringing this (back) up.
> 
> It is still on my list, but now back nearer the top :)
> 
> Paul
> 
> 
> On 14/11/2021 12:51 am, Gu, Zuguang wrote:
>> Dear developers,
>>
>>
>> In grid::gpar(), graphic parameters are not allowed to have length 0, 
>> but this can be done by first creating a gpar object and later 
>> modifying it:
>>
>>
>> gp = gpar(fontsize = 10)
>>
>> gp$fontsize = numeric(0)
>>
>>
>> when a grob has a gp where some parameters have length 0, converting 
>> the width or height of this grob will crash R.
>>
>> ?
>>
>> A reproducible example is as follows:
>>
>>
>>  > library(grid)
>>
>>  > gp = gpar(fontsize = 10)
>>  > gp$fontsize = numeric(0)
>>  > gb = textGrob("foo", gp = gp)
>>  > convertWidth(grobWidth(gb), "mm")
>> [1] 21045 floating point exception R??
>>
>>
>> Best regards,
>>
>> Zuguang Gu
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel 
>> <https://stat.ethz.ch/mailman/listinfo/r-devel> 
>>
> 

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



More information about the R-devel mailing list