From: Paul Murrell (email@example.com)
Date: Fri 21 Sep 2001 - 13:05:14 EST
There are new versions of the grid and lattice packages on CRAN:
grid 0.2 and lattice 0.3-0
These packages are still _under development_ (they are in
There have been some bug fixes and, especially in lattice, there are lots of
Descriptions of the changes are included below.
If you have any grid code, it may break under the new version because of a
change to the interface of the pop.viewport() function -- see the changes
Many thanks to those who have provided feedback and suggestions for
Don't worry if you can't see your suggestion in the new version; it just
means we haven't found time to try to implement it yet :)
Changes from grid_0.1 to grid_0.2:
1. Fixed bug in rotating viewports; this should be more reliable now (the
viewports, not the bug!).
2. Added grid.line.to() and grid.move.to(). These allow drawing BETWEEN
different coordinate systems. See example in inst/doc/demo3.ps.
3. Added some more demonstrations to the doc directory.
4. Added more test code to the tests directory.
5. Added "grobwidth" and "grobheight" units. See the document
6. Added more detailed documentation to grid/inst/doc/advanced. This
stuff is not necessarily very friendly for the reader, but may be useful
tearing your hair out wondering why some strange effect is occurring.
7. Changed frames and packing to use the new "grobwidth" and "grobheight"
units. This fixes some problems with frames and packing.
8. Fixed a bug where the gpar settings for "fontsize" and "lineheight"
_within a grob_ would not affect the location or size of the grob
if they were specified in "lines" or "char" units.
This required adding new "mylines" and "mychar" units (alternative
suggestions for names welcome !) so that you can specify whether
a grob's a location/size is in terms of the current viewport's
fontsize and lineheight ("lines" and "char") or in terms of its own
fontsize and lineheight ("mylines" and "mychar").
9. Added grid.polygon() and grid.circle() primitives
10. Added newpage=TRUE argument to grid.start() so that you can restart
grid graphics mode without having to move to a new page.
For example, try ...
grid.start() # moves to new page
grid.start(newpage=FALSE) # does NOT move to new page
11. Changed interface for pop.viewport(). This now just takes a
number of viewports to pop, which defaults to 1.
For example ...
... becomes ...
... and ...
vp1 <- viewport()
vp2 <- viewport()
... becomes ...
vp1 <- viewport()
vp2 <- viewport()
12. Speed-up of pushing and popping viewports. This will probably not
be noticeable in normal usage, but makes a big difference for
frames and packing.
13. Added a convertNative() function for converting a unit object
to "user" or "data" coordinates. This is useful for performing
calculations (e.g., smoothing) on a location or dimension which
is easiest to specify in units.
You must specify whether you wish to convert relative to the
current x- or y-scale AND whether you are converting a location
or a dimension. The following example shows the difference:
> push.viewport(viewport(w=unit(4,"inches"), xscale=c(-10,10)))
> convertNative(unit(1:4, "inches"))
 -5 0 5 10
> convertNative(unit(1:4, "inches"), "y")
 0.1430986 0.2861972 0.4292958 0.5723944 # on my default window
> convertNative(unit(1:4, "inches"), "y", "dimension")
 0.1430986 0.2861972 0.4292958 0.5723944
> convertNative(unit(1:4, "inches"), "x", "dimension")
 5 10 15 20
WARNING: if you draw objects based on output from these conversion
functions, then resize your device, the objects will be drawn
incorrectly -- the base R display list will not recalculate these
conversions. This means that you can only rely on the results of
these calculations if the size of your device is fixed.
This change motivated by discussions with Frank Harrell.
Changes in lattice 0.3
The overall internal structure of the lattice library has changed
considerably in verion 0.3, in particular making it far more readable
and debuggable. However, this also means that some code which had
worked with the earlier version might now fail. (This is just a
discalimer, there are no known instances.)
o (Almost) full support for the `key' argument for drawing legends
o Support for log scales
o levelplot (but no contourplot. In particular, the contour = T option
in levelplot does not work)
o tmd now works on the output from qq
o panel function names can now be quoted strings
o scales and its x and y components can now be just a character
string like "free" or "sliced", i.e., the relation tag can be
o extension to the `type' argument in panel.xyplot and
panel.superpose to allow stair-like and histogram-like plots
(type="s" and "h" in plot), as well as loess smooths (using
the loess.smooth function in the modreg library). Also, more
than one of these options can now be used concurrently. This
allows, for example, a grouped plot where a grouping variable
can be used to fit separate loess curves along with the scatter
for each group. See example(xyplot)
o wrappers around grid functions with API-s of traditional graphics
functions to help port existing S-Plus Trellis code. See below for
o changes in print.trellis to allow mixing of Lattice and usual R
graphics. See below for details.
o `data' can now be second unnamed argument in
high level functions
o `pscales' implemented for splom
Porting S-Plus Trellis code to Lattice
One of the basic problems in porting existing Trellis code to R is the
unusability of the base R functions like lines and points inside panel
functions. To help make the changes more transparently, lattice now
includes several wrappers around grid functions that provide an API
similar to the corresponding base R functions. The list currently
includes lpoints, llines, ltext and lsegments.
Using Lattice and base R graphics concurrently
Grid graphics normally do not mix with usual R graphics. However,
end-users typically might want to use lattice functions concurrently
with traditional R graphics. To allow this without intermittent calls
to grid.stop() and grid.start(), print.trellis (which ultimately does
all the plotting in lattice) now tries to preserve the state of the
device on which it plots. By default, library(lattice) opens a device
in grid enabled mode. It can be reverted to non grid mode by
grid.stop(). Subsequently, both Lattice functions and traditional
graphics functions can be used. Devices opened by trellis.device()
start in non-grid mode, unless grid.start() is called.
o contourplot, wireframe, cloud (partially implemented) and of course,
o Some components of scale (I haven't found a full list, so
can't say exactly which are missing)
o axis labels badly implemented, no checking for overlaps.
r-announce mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org
This archive was generated by hypermail 2.1.3 : Thu 17 Jan 2002 - 11:16:01 EST