[R] Barchart legend position

2007-06-22 Thread Spilak,Jacqueline [Edm]
I am using barchart to make charts for some data with a lot more
functions and labels and such in the command.

barchart(Freq ~ factor(HH), data = dataset1, group= year) 

So I have my data grouped by year and I get a legend at the top of
graph, which is great cause I need the legend for the different years
but it is a weird spot.  So how can I manipulate the legend, ie. Move
it, shrink it, do anything with it. I have searched the help archives
and found nothing, and I have looked up the legend section in ?barchart
but that has not helped or I am doing something wrong.  Any help is
greatly appreciated.
Jacquie

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.


Re: [R] Barchart legend position

2007-06-22 Thread Deepayan Sarkar
On 6/22/07, Spilak,Jacqueline [Edm] [EMAIL PROTECTED] wrote:
 I am using barchart to make charts for some data with a lot more
 functions and labels and such in the command.

 barchart(Freq ~ factor(HH), data = dataset1, group= year)

 So I have my data grouped by year and I get a legend at the top of
 graph, which is great cause I need the legend for the different years
 but it is a weird spot.  So how can I manipulate the legend, ie. Move
 it, shrink it, do anything with it. I have searched the help archives
 and found nothing, and I have looked up the legend section in ?barchart
 but that has not helped or I am doing something wrong.  Any help is
 greatly appreciated.

I can be more specific if you say what exactly you want to do
(preferably with a small reproducible example). The relevant
documentation is the part under 'key' in help(barchart). I prefer to
use 'auto.key' instead (and you haven't told us what you are using),
but most components of 'key' can be passed through 'auto.key'. Some
examples:


barchart(Titanic,
 auto.key = list(space = right, size = 2, cex = 0.5))


barchart(Titanic,
 auto.key = list(x = 0.75, y = 0.25, size = 2))


## choose location interactively:

library(grid)

barchart(Titanic,
 page = function(n) {
 cat(Click on plot to place legend, fill = TRUE)
 ll - grid.locator(unit = npc)
 if (!is.null(ll))
 draw.key(simpleKey(dimnames(Titanic)$Survived,
rect = TRUE, points = FALSE),
  vp = viewport(x = ll$x, y = ll$y),
  draw = TRUE)
   })


-Deepayan

__
R-help@stat.math.ethz.ch 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.