[R] "figure margins too large" in RGtk2 drawing area as cairo device - why?

Mark Heckmann mark.heckmann at gmx.de
Thu Mar 8 23:26:04 CET 2012


Peter, thanks for the answer!
Indeed, it does work if I set par(mar=c(0,0,0,0)) but not when it is set to the default values mar=c(5.1, 4.1, 4.1, 2.1).
The par settings returned in the example are the defaults, so no extraordinary big mar settings or char size (see below).
Also, it does not matter what size the drawing area is set to (e.g. 1000x 1000). The error always occurs.
Any idea?

examples:

> win = gtkWindow()
> da = gtkDrawingArea()
> win$add(da)
> asCairoDevice(da)
[1] TRUE
> par(c("mar", "cra", "oma"))
$mar
[1] 5.1 4.1 4.1 2.1

$cra
[1]  7 11

$oma
[1] 0 0 0 0

> plot(1:10)   
Fehler in plot.new() : Grafikränder zu groß  ###ERROR###

Thanks 
Mark

Am 08.03.2012 um 22:48 schrieb peter dalgaard:

> 
> On Mar 8, 2012, at 20:27 , Mark Heckmann wrote:
> 
>> When using a gtkDrawingArea as a Cairo device I very often encounter the error: "figure margins too large" 
>> Even for the below "getting started" example from http://www.ggobi.org/rgtk2/ this is the case.
>> 
>>> win = gtkWindow()
>>> da = gtkDrawingArea()
>>> win$add(da)
>>> asCairoDevice(da)
>> [1] TRUE
>>> plot(1:10)   
>> Fehler in plot.new() : Grafikränder zu groß
>>> 
>> 
>> Also enlarging the drawing area does not help.
>> 
>>> win = gtkWindow()
>>> da = gtkDrawingArea()
>>> win$add(da)
>>> asCairoDevice(da)
>> [1] TRUE
>>> da$setSizeRequest(700, 700)
>>> plot(1:10)   
>> Fehler in plot.new() : Grafikränder zu groß
>> 
>> Any ideas?
> 
> I'd check the par() settings for the device. Especially mar/mai and cra/cin to see whether margins are set unusually large and/or character sizes are unusually big, but check help(par) yourself. 
> 
> -- 
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
> 
> 
> 
> 
> 
> 
> 
> 

––––––––––––––––––––––––––––––––––––
Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com



More information about the R-help mailing list