Friday 19 February 2016

R Grid Package Introduction

Cited from the paper "Fun with the R Grid Package"

By default, the coordinates of the lower left corner of a viewport are (0, 0), and the upper right corner has coordinates 1.

upViewport(2)

The argument in brackets determines the number of generations to move up the viewport tree.

The use of col=NA prevents the outlines from being drawn.

The clip="on" makes it possible to “spill” an graphic object outside the viewport region.

Two ways to interact with a grob (graphic object):
Directly,
grid."shape"()

Indirectly,
"shape"Grob()

If modify we want a grob to draw by using one the of these functions grobs, we could use the and grid.draw() function. We can modify a grob by using the functions grid.edit() and editGrob().

The function gList() allows us to create a list of grobs. It facilitates the construction of several items in one plotting region together.

The function gTree() creates a tree-structure which can be used to organise the components of more complicated graphic objects. Such a tree-structure contains several grobs nested together. In a tree-structure, a grob can contain other grobs. The "children" argument specifies the components of the gTree. The children component is usually a list, constructed by gList.





No comments:

Post a Comment