Rev 26788 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
Changes from grid_1.8.0 to grid_1.9.0:------------------------------------1. Renamed push/pop.viewport() to push/popViewport().2. Added upViewport(), downViewport(), and seekViewport() toallow creation and navigation of viewport tree(rather than just viewport stack).3. Added id and id.lengths arguments to grid.polygon() to allowmultiple polygons within single grid.polygon() call.4. Added vpList(), vpStack(), vpTree(), and current.vpTree()to allow creation of viewport "bundles" that may be pushedat once (lists are pushed in parallel, stacks in series).current.vpTree() returns the current viewport tree.5. Added vpPath() to allow specification of viewport pathin downViewport() and seekViewport().See ?viewports for an example of its use.NOTE: it is also possible to specify a path directly,e.g., something like "vp1::vp2", but this is onlyadvised for interactive use (in case I decide to change theseparator :: in later versions).6. Added "just" argument to grid.layout() to allow justificationof layout relative to parent viewport *IF* the layout is notthe same size as the viewport. There's an example inhelp(grid.layout).Changes from grid_1.8.0 to grid_1.8.1:------------------------------------1. I have effectively disabled the "mystrwidth", "mystrheight","mychars", and "mylines" units. These are now identical inbehaviour to the equivalent units without the "my".Another way to look at it is that I have modified the behaviourof "lines", "chars", "strwidth", and "strheight" so that theyALWAYS obey the latest gpar settings (including any gparsettings in a grob).Some examples ...This text is sized AND positioned in terms of a fontsize of 6:grid.text("small text and small lines", y=unit(2, "lines"),gp=gpar(fontsize=6))This text is 6 pt in size, but is positioned in terms of the(default on X11) fontsize 12:push.viewport(viewport(y=unit(2, "lines")))grid.text("small test and big lines", gp=gpar(fontsize=6))pop.viewport()2. Fixed a bug in the calculation of "grobwidth" and "grobheight"units. The following code demonstrates the problem (the blackrectangle should snugly bound the grey rectangles):grid.newpage()# Create a frame with fontsize=6gf <- grid.frame(layout=grid.layout(10, 10,widths=unit(rep(1, 10), "strwidth",as.list(rep("o", 10))),heights=unit(rep(1, 10), "strheight",as.list(rep("o", 10)))),gp=gpar(fontsize=6))# Add a rect to the framefor (i in 1:10)grid.place(gf, grid.rect(gp=gpar(col="grey"), draw=FALSE),col=i, row=i)grid.draw(gf)# Now draw a rect around the framegrid.rect(width=unit(1, "grobwidth", gf),height=unit(1, "grobheight", gf))3. Fixed a bug in the implementation of the "cex" gpar. This is nowused correctly in the transformation code in unit.cThe bug was demonstrated by the following simple example(the second set of points should be twice the radius of thefirst set of points):grid.newpage()push.viewport(viewport())grid.points()grid.points(gp = gpar(cex = 2))Another demonstration from the original bug report from David Hinds:xyplot(1:4~1:4, cex=1:4, pch=1)Changes from grid_0.7-4 to grid_1.8.0:------------------------------------1. grid.text() now checks that the rot argument is numeric and finite.2. dataViewport() checks for is.null(<arg>) rather than missing(<arg>)and has renamed arguments x and y to xData and yData.All to avoid confusion with specifying x= and y= in the ... argument.This also fortuitously fixed a bug in dataViewport where thecalculation of the x-range was partially dependent on the y-range(!)Thanks to Russell Norvell for spotting and reporting the bug.3. unit() checks that units argument is character mode.Fix for bug (first reported by Achim Zeileis) produced by,for example ...unit(1, 2)4. The function absolute.units() was recursive and now uses a loop.Fixes the following problem (from Deepayan Sarkar):gf <- grid.frame(layout = grid.layout(nrow=1, ncol=1), draw = FALSE)grob.rect <- grid.rect(x = 1:99/100, y = 1:99/100,h = rep(.01, 100), w = rep(.05, 100),gp = gpar(col = terrain.colors(100)),draw = FALSE)grid.pack(frame = gf, row = 1, col = 1,grob = grob.rect,draw = FALSE)grid.draw(gf) # Fails with stack overflow5. There is now a grid.locator() function for interactively selectinglocations within the current grid viewport with a mouse.6. There is a new grid.convert() function for converting betweendifferent coordinate systems.The convertNative() function has been deprecated.7. The default "top-level" viewport that is generated by gridnow has its "native" coordinate system set to the "native"coordinate system of the device. For example, "native"units at the top-level correspond to points on a PostScriptdevice, pixels on an X11 device, and so on.For example, try the following:library(grid)x11()grid.rect(x=10, y=10, width=10, height=10,default.units="native")This may cause consternation if you ever plot grid.points()at the top-level because the default units for grid.points()are "native" ... I consider this an unlikely occurrence.8. Added a new gpar called "alpha" for specifying transparency.This is supposed to be a number from 1 (opaque) to 0 (transparent).No R devices will take any notice of this whatsoever as yet.9. Modified "xaxis" and "yaxis" grobs so that they extend the"collection" class. This means that, when a new generic functionis created, it may be possible to write methods just for thecollection class and not also separate xaxis and yaxis methods.10. Modified unit subsetting so that logical indices work.For example ...unit(1:4, "npc")[1:4 == 3]11. Fixed detaching/reloading of grid package (was causing an error).12. There is a new grid.arrows() primitive.See the help file for example usage.13. Grid is now a base package (hence version number leap!)Changes from grid_0.7-3 to grid_0.7-4:------------------------------------1. Fixed the bug in the bug-fix in item 7. below.Changes from grid_0.7-2 to grid_0.7-3:------------------------------------1. Properly removed "origin" settings from viewports.2. Modified grid.pretty() slightly so that it would respondsensibly/usefully to things like ...grid.pretty(c(10, 0))A side-effect of this is that the following sort of viewportscale specifications become sensible/useful ...push.viewport(viewport(layout=grid.layout(1, 2)))push.viewport(viewport(layout.pos.col=1))push.viewport(viewport(w=.8, h=.8,xscale=c(10,0)))grid.points(1:10, 1:10/11)grid.xaxis()grid.yaxis()pop.viewport(2)push.viewport(viewport(layout.pos.col=2))push.viewport(viewport(w=.8, h=.8,yscale=c(10,0)))grid.points(1:10/11, 1:10)grid.xaxis()grid.yaxis()pop.viewport(3)3. Fixed the calculation of number of "vertices" in grid.lines so thatit is the maximum of length(x) and length(y).Used to be calculated solely on length(x).4. Grid now throws an error if you try to create a unit of length 0.This to fix a bug reported by Bud Gibson, the essence of which was ...grid.points(size=unit(numeric(0), "mm"))5. The default value of the "at" argument for grid.xaxis() andgrid.yaxis() is NULL (was NA; NA was inconsistent with otherdefault argument settings and basically a dumb idea)6. Grid now throws an error if you try to create a gpar object withan element of length 0.This is to fix a bug reported by Michael Friendly (and diagnosed byBrian Ripley), the essence of which was ...grid.lines(gpar(fontsize=numeric(0)))7. grid.text() now converts its label argument to a string.This is to fix a bug where "grobwidth" or "grobheight" wouldsegfault if given a text grob for which the label was not a string.(The fix involved including a check for "mystrwidth" and "mystrheight"units in valid.data).The bug could be produced by ...grid.rect(w=unit(1, "grobwidth", data=grid.text(5)))Changes from grid_0.7-1 to grid_0.7-2:-------------------------------------1. Fixed some generic/method incompatibilities (pointed out by Kurt).Changes from grid_0.7 to grid_0.7-1:------------------------------------1. Fixed a bug where layout matrix respect was not being applied tothe correct cell. For example, the following caused the cell1,3 to be respected rather than 1,2 ...lt.resp <- matrix(0, 2, 3)lt.resp[1,2] <- 1grid.show.layout(grid.layout(2, 3, respect = lt.resp))Reported by Deepayan Sarkar.Changes from grid_0.6 to grid_0.7:------------------------------------1. The web pages for grid have moved to ...http://www.stat.auckland.ac.nz/~paul/grid/grid.html2. Mathematical annotation is now available in grid.Wherever grid expects a string, an expression may be used instead.This covers not only producing mathematical annotation output,but also correctly calculating width and height of expressions,and checking for overlapping expressions.3. If you try to save/load a grid grob, it will now fail gracefullyrather than seg faulting.4. If you save a display list containing grid output, then detachgrid, then try to run the display list again, it will now failgracefully rather than seg faulting.5. All gpar() settings can now be vectors. Well, they could alwaysbe vectors, but now values other than the first one will have aneffect. This will not happen in all contexts, for example,viewports will only take notice of the first value in each setting,but for graphics functions where multiple items can be output,multiple settings may be sensibly given. Some examples are:# multiple points with different coloursgrid.points(1:10/11, 1:10/11, gp=gpar(col=1:10))# multiple segments with different coloursgrid.segments(1:10/11, 0, 1:10/11, 1, gp=gpar(col=1:10))# multiple points with different sizesgrid.points(1:10/11, 1:10/11, size=unit(1:10, "mm"))# multiple pieces of text with different font sizesgrid.text(1:10, x=1:10/11, gp=gpar(fontsize=10:20))# multiple rects with different lineheights (and height is in "lines")grid.rect(width=.05, x=1:10/11,height=unit(1, "mylines"),gp=gpar(lineheight=1:10))6. (Because of a fix to R/src/main/engine.c ...)Multiple-line text (i.e., text with "\n"s in it) is now correctlyspaced vertically (i.e., takes notice of the current value of"fontsize").NOTE, however, that multiple-line text still takes no notice of thecurrent value of "lineheight".7. Fixed a bug in grid.layout(). It was the case that, if youentered widths or heights which were not unit objects, theywere not converted properly to unit objects.8. Modified the defaulting of "just" arguments when a single valueis provided. See the new example in grid.text.9. Fixed a bug where grid.points(pch=NULL) would cause a crash.This now defaults pch to the value 1.10. Added "fontfamily" and "fontface" gpar() settings. The fontfamilysetting will mostly be ignored until devices are modified to takenotice of the extra information, BUT this can be used NOW tospecify a Hershey Font family (on all devices). The fontfacesetting is designed to take over from the old "face" setting,but the latter is retained for backward compatibility.Changes from grid_0.5-1 to grid_0.6:------------------------------------1. Some internal changes to speed up creation of unit objects.This may have a noticeable effect on drawing legends and anythingthat relies on grid frames (e.g., "key"s in lattice).2. A couple of bug fixes for "grobwidth" and "grobheight" units.Symptoms were legends not being allocated the correct amount ofspace.Thanks to Deepayan Sarkar and Peter Kleiweg for help diagnosingthe bug and testing the fix.3. Added plotViewport() and dataViewport()convenience function for creating aviewport that has the typical layout of an R plot.4. Altered viewport() function so that layout.pos.row and layout.pos.colcan be specified as a sequence and only the range() of thatsequence is used.5. Removed most documentation from the package to reduce the downloadsize. The user's guide and changes file are included with thetar ball, but the other documents are only available viahttp://www.stat.auckland.ac.nz/PEOPLE/paul/grid/grid.htmlAlso changed the format of the user's guide from postscript to pdf.6. Fixed bug in unit.length where the length of a unit.arithmetic objectwas calculated incorrectly if the length() of the scalar multiplierwas longer than the unit.length() of the unit object being multiplied.7. Allowed character settings for pch in grid.points()8. The crash on Windows platforms when plot history is turned onhas been fixed in R version 1.5.This fix means that grid_0.6 will only run on R version >= 1.5.09. Added handling of NULL values for gpar elements. Except for coland fill, this now means the same as specifying no setting at allfor the element -- previous behaviour was a segfault.Changes from grid_0.5 to grid_0.5-1:------------------------------------1. Fix for some grid bugs.The problems were:(i) grid output could not be saved in metafile format(ii) non-grid output could not be saved in metafile format whengrid was loaded(iii) empty page at start of grid postscript output(iv) empty page at start of non-grid postscript output whengrid was loaded(v) copying grid output from x11 to postscript (dev.copy)produced blank pages in postscriptThese problems were due to two things in grid:(i) grid created a new page whenever a new device was started.(ii) grid created a new page whenever the display list wasreplayed (e.g., when a device was resized or the outputwas copied from one device to another)Grid now only creates a new page the first time grid output isproduced on a device AND only creates a new page for replayingthe display list IF there has already been grid output on the device.Changes from grid_0.2 to grid_0.5:----------------------------------1. R has a new device API and a new graphics engine. Grid uses these.This means that this version will NOT work on R versions before 1.4.0Another known "bug" is that this version of grid will crash R ifused in Windows with plot history recording turned on (although"add"ing individual grid "plots" to the plot history should stillwork).2. Added "mystrwidth" and "mystrheight" units; basically these justcomplete the set of units which depend on font, fontsize, and/orlineheight and therefore may refer to the current viewport settingsof these parameters OR to the current settings of the grob beingdrawn.3. Added unit.rep function (the base rep() function is not genericso I could not simply write a rep.unit method).4. Added new gpar, "gamma", for gamma-correction of colours(defaults to 1). NOTE that only windows devices will currentlyrespond to on-the-fly changes in gamma.5. Added "clip" flag to viewports. If "clip" is TRUE, then outputis clipped to the viewport.Clipping obeys only the most recent viewport clip setting.For example, if you clip to viewport1, then clip to viewport2,the clipping region is determined wholly by viewport2, thesize and shape of viewport1 is irrelevant (until viewport2is popped of course).If a viewport is rotated (because of its own "angle" settingor because it is within another viewport which is rotated) thenthe "clip" flag is ignored.6. The functions grid.start() and grid.stop() have been removed.grid automatically "registers" with devices.7. Grid no longer automatically opens a device when it is loaded.Instead, a device is created, if there are none open, when thefirst drawing occurs or when the first viewport is pushed.8. Added new functions unit.pmin() and unit.pmax() which are unitversions of pmax() and pmin()9. Added new function grid.place() which provides a simplerinterface to grid.pack() and is useful for using grid "frame"sas just a convenient way of defining a layout and stickingthings in it.Changes from grid_0.1 to grid_0.2:----------------------------------1. Fixed bug in rotating viewports; this should be more reliable now.2. Added grid.line.to() and grid.move.to(). These allow drawing BETWEENdifferent 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 documentgrid/inst/doc/advanced/parentchild.ps6. Added more detailed documentation to grid/inst/doc/advanced. Thisstuff is not as friendly for the reader, but may be useful if you'retearing 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 grobif they were specified in "lines" or "char" units.This required adding new "mylines" and "mychar" units (alternativesuggestions for names welcome !) so that you can specify whethera grob's a location/size is in terms of the current viewport'sfontsize and lineheight ("lines" and "char") or in terms of its ownfontsize and lineheight ("mylines" and "mychar").9. Added grid.polygon() and grid.circle() primitives10. Added newpage=TRUE argument to grid.start() so that you can restartgrid graphics mode without having to move to a new page.For example, try ...postscript()grid.start()grid.polygon()grid.stop()grid.start() # moves to new pagegrid.circle()grid.stop()grid.start(newpage=FALSE) # does NOT move to new pagegrid.rect()grid.stop()dev.off()11. Changed interface for pop.viewport(). This now just takes anumber of viewports to pop, which defaults to 1.For example ...push.viewport(viewport())pop.viewport(current.viewport())... becomes ...push.viewport(viewport())pop.viewport()... and ...vp1 <- viewport()vp2 <- viewport()push.viewport(vp1, vp2)pop.viewport(vp2, vp1)... becomes ...vp1 <- viewport()vp2 <- viewport()push.viewport(vp1, vp2)pop.viewport(2)12. Speed-up of pushing and popping viewports. This will probably notbe noticeable in normal usage, but makes a big difference forframes and packing.Changes from lattice_0.2 to grid_0.1:-------------------------------------0. Change of package name from "lattice" to "grid" (!!!!)This means that most user functions have changed from l<something>to grid.<something>1. Slight speed up of grid.push.viewport and grid.pop.viewport.2. Added sum() method for units.For example, try ...grid.rect(w=sum(unit(c(.25,.25), "npc")))grid.rect(w=sum(unit(c(.25,.25), "npc"), unit(1, "cm")), border="red")3. Changed the usage of grid.edit() slightly. If you want to specifyseveral new values at once, you must use grid.prop.list() ratherthan just list(). For example, for a single new value use ...grid.edit(<grob>, col="red")... as before, but for multiple new values use ...grid.edit(<grob>, grid.prop.list(col="red", lty="dashed"))... rather than ...grid.edit(<grob>, list(col="red", lty="dashed"))4. Added a new grid.frame() grob. This acts a bit like a simplegrid.collection() BUT controls the placement of its children.You add children using the grid.pack() function.5. All viewports and grobs now have a "gp" slot which contains a"gpar" object. This is a list of graphical parameters, whichreplaces the specification of individual graphical parametersfor each different type of grob.For example, instead of the old ...grid.rect(w=.8, h=.8, border="red")... we have the new ...grid.rect(w=.8, h=.8, gp=gpar(border="red"))This may seem like a loss (because you have to type more stuff),and it is a loss, but the (hopefully greater) win is that (i) you onlyhave one parameter for all graphical settings, for example, ...grid.rect(w=.8, h=.8, gp=gpar(border="red", lwd=3))... and (ii) this applies for all grobs, for example, ...grid.text("hi", gp=gpar(col="red", fontsize=10))... and (iii) you can add more graphical parameters with minimal fuss,for example, ...grid.text("hi", gp=gpar(col="red", fontsize=10, new.par=whatever))... and (iv) its easier to automate things (see below).Graphical parameter settings are "permanent" so, for example, ifan axis sets the colour to "red" then all of its children aredrawn in "red" unless they set colour to something else.For example, try ...grid.multipanel(vp = grid.viewport(0.5, 0.5, 0.8, 0.8,gp=gpar(fontsize=20)))... and notice that all of the components of the multipanel takenotice of the fontsize setting of the parent viewport (except theaxis labels because they explicitly set the fontsize to 20 themselves).The setting of graphical parameters is automated;if you have a slot called "gp" in your grob, Lattice willset the graphical parameters in that slot before callingdraw.details() and unset the parameters afterwards.6. The pushing and popping of "local" viewports has been automated.If you have a slot called "vp" in your grob, Lattice will callgrid.push.viewport() on that slot before calling draw.details()and grid.pop.viewport() afterwards.7. "collection" grobs and "[x|y]axis" grobs no longer pass editingoperations down to their children.This was mainly (only ?) for sharing graphical parameter settingsand that duty is now performed by the gpar stuff in point 5 above.This is a good thing because there are some cases where passingdown editing operations could cause serious damage. For example,consider what would have happened if you had edited the "vp" slotof a collection grob (!)