[R-gui] embedding R graphics in Tk widgets

Felix Andrews felix at nfrac.org
Fri Jun 13 07:20:24 CEST 2008


I have heard about this "figure margins too large" error a few times,
always on Linux.

It sounds like the window is being created too small. I do not know
why. (Does the new playwith window look very small? It is supposed to
be 640 x 500 pixels by default.)

A work-around would be to resize the window to make it larger, then
re-do the playwith() call, or click on the "reload" button in the
playwith window.

Regards,
Felix


On Fri, Jun 13, 2008 at 2:05 PM, Sebastian P. Luque <spluque at gmail.com> wrote:
> On Thu, 12 Jun 2008 20:46:34 -0700,
> "Michael Lawrence" <mflawren at fhcrc.org> wrote:
>
>> Well, this doesn't really solve your Tk problem, but you could
>> integrate graphics with a GUI using cairoDevice and RGtk2. The
>> cairoDevice package supports resizing, and using par("plt") and
>> par("usr") as in the tkrplot example you cited allows for mapping
>> between device and data coordinates.
>
>> See the playwith package for an example of interactive graphics using
>> cairoDevice.
>
> Thanks Michael, I'll look at the code, but trying playwith() gave a few
> errors, although the package installed ok:
>
> ---<---------------cut here---------------start-------------->---
> R> playwith(plot(treering2, xlim=c(0,300)),
> +         time.mode = TRUE,
> +         labels = paste(time(treering2), "CE"))
> Loading required package: RGtk2
> Error in plot.new() : figure margins too large
> R> Error in if (playState$is.lattice) { : argument is of length zero
> R> sessionInfo()
> R version 2.7.0 (2008-04-22)
> x86_64-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] RGtk2_2.12.5-3  playwith_0.8.51 lattice_0.17-8
>
> loaded via a namespace (and not attached):
> [1] cairoDevice_2.8      gridBase_0.4-3       gWidgets_0.0-28      gWidgetsRGtk2_0.0-35 tools_2.7.0
> ---<---------------cut here---------------end---------------->---
>
> But I guess I can see how to work with CairoDevice and RGtk2 by looking
> at the source.  Thanks.
>
>
> --
> Seb
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>



-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8



More information about the R-SIG-GUI mailing list