Dear r-help, Now I am drawing graphs with xyplot function. In order to place a legend under the plots I use the key argument in the xyplot function. One of the 'key' components is 'divide', which defines a number of points on the each line of the legend. The default is 3 points. I would like a single point, so I set divide = 1. Call to xyplot didn't produce any points at all. The body of draw.key function contains the following pointsGrob(x=(1:key$divide-1)/(key$divide-1), y=rep(0.5,key$divide), [skip] ) When key$divide=1, x is NaN... -- Best regards Wladimir Eremeev mailto:wl at eimb.ru =========================================================================Research Scientist, PhD Leninsky Prospect 33, Space Monitoring & Ecoinformation Systems Sector, Moscow, Russia, 119071, Institute of Ecology, Phone: (095) 135-9972; Russian Academy of Sciences Fax: (095) 135-9972
On Friday 20 May 2005 07:05 am, Wladimir Eremeev wrote:> Dear r-help, > > Now I am drawing graphs with xyplot function. > > In order to place a legend under the plots I use the key argument in > the xyplot function. > > One of the 'key' components is 'divide', which defines a number of > points on the each line of the legend. The default is 3 points. > I would like a single point, so I set divide = 1. > > Call to xyplot didn't produce any points at all. > > The body of draw.key function contains the following > > pointsGrob(x=(1:key$divide-1)/(key$divide-1), y=rep(0.5,key$divide), > [skip] > ) > > When key$divide=1, x is NaN...There's certainly a problem (at least one of omission in the documentation), but I'm not sure what the best way to resolve it would be. This is what currently happens on S-PLUS (6.0) and R: divide = 3: o--o--o S-PLUS/R divide = 2: o-----o S-PLUS/R divide = 1: o S-PLUS ------- R The difference in the 'divide = 1' case was not intentional, I just never checked it. Possible `solutions' are: 1. keep things as they are and clarify the documentation (namely, saying that 'divide' has to be greater than 1 to make sense) 2. change it to behave like S-PLUS (but that seems silly, since one might then just as well use 'points' instead of 'lines') 3. do something else entirely, like ---o--- . This is not attractive from a programmers point of view because it makes 'divide = 1' behave inconsistently with other values of 'divide'. I'm open to suggestions. Deepayan
Dear all. I have found one more minor bug in the Lattice package. When xyplot plots several curves on each panel with the default panel function panel.xyplot, and when it is called with "g" %in% type (that is, xyplot(y1+y2+y3~x|cond,allow.multiple=TRUE,type=c("o","g"),<other params>) ), it draws grid lines several times (for each curve), and it appears, that they overlay all curves plotted, except the last one. I think there is a need to establish some kind of flag, showing, that the grid is already drawn, and other runs of the panel.xyplot for the same panel must not draw it again. I was looking to the source of the xyplot, but haven't found any place to put the flag. Another solution could be to establish separate types for each curve on the plot... However, AFAIK, they are not all intercompatible. There is also need to do something with custom panel functions... Hmm... The task looks complex to me now. :) Any suggestions? --- Best regards, Wladimir