[R] navigating ggplot viewports

From: Felix Andrews <felix_at_nfrac.org>
Date: Tue, 15 Jan 2008 13:26:14 +1100


list(...)

I can not get at the grid viewports in a ggplot2 plot. I know there is supposed to be a viewport called "panel_1_1" but downViewport() can't find it. Has the viewport been popped? I had a quick look at the functions involved (eg ggplot_plot) but there is no obvious problem there.

> library(ggplot2)
> qplot(1:10, 1:10)

> current.viewport()

viewport[ROOT]
> downViewport("panel_1_1")

Error in downViewport.vpPath(vpPathDirect(name), strict, recording = recording) :
  Viewport 'panel_1_1' was not found
> current.vpTree()

viewport[ROOT]->(viewport[GRID.VP.1])
> grid.ls(viewports=T, grob=F)

ROOT
  GRID.VP.2
    1
  GRID.VP.3
    layout

      strip_h_1_1
        1
      strip_v_1_1
        1
      axis_h_1_1
        1
      axis_v_1_1
        1
      panel_1_1
        2
    layout
      panel_1_1
        2
    layout
      axis_v_1_1
        left_axis
          labels
            1
          ticks
            2
        left_axis
          ticks
            2
        left_axis
          labels
            2
        2
    layout
      axis_h_1_1
        bottom_axis
          labels
            1
          ticks
            2
        bottom_axis
          ticks
            2
        bottom_axis
          labels
            2
        2
    layout
      panel_1_1
        2
    layout
      panel_1_1
        2
    layout
      panel_1_1
        2

    1
  GRID.VP.4
    1
  GRID.VP.5
    1
  GRID.VP.6
    1

> sessionInfo()

R version 2.6.1 (2007-11-26)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

attached base packages:
[1] splines grid stats graphics grDevices utils datasets [8] methods base

other attached packages:

[1] ggplot2_0.5.7      colorspace_0.95    RColorBrewer_1.0-2 MASS_7.2-38
[5] proto_0.3-8        reshape_0.8.0

loaded via a namespace (and not attached): [1] tools_2.6.1

-- 
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


______________________________________________ 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.

Received on Tue 15 Jan 2008 - 02:30:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Jan 2008 - 19:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive