Add the "adj" argument to panel.text to left (adj = 0) or right(adj = 1) justify the text. Add the "font" argument to change the font. See ?text.
--sundar On Wed, Feb 11, 2009 at 1:25 PM, Dimitri Liakhovitski <ld7...@gmail.com> wrote: > Thanks a lot, Sundar. I experimented somewhat and here is the code > that works well - it allows me to modify most of the stuff I want to > modify: > > p<-as.vector(c(0.1, 0.2, 0.3, 0.4)) > names(p)<-c("AAAAA","BBBBBB","CCCCCCCCCCCC","DDDDDDDD") > barchart(~sort(p), main=list("Chart Title",cex=1),xlab=list("X axis > title",cex=1),xlim=c(0,0.42), > layout = c(1,1), > stack = TRUE, > auto.key = list(points = FALSE, rectangles = TRUE, space = > "top"), > panel = function(y,x,...){ > panel.grid(h = 0, v = -1, col = "gray60", lty > ="dotted") > panel.barchart(x,y,col="brown") > panel.text(x,y,label = round(x,2),cex=1) > } > ) > > One last question: How can I modify the way the value labels (those > that are at the end of the bars) appear? Can I make them bold? Make > them appear a bit to the right or to the left of where they currently > are? > Thanks a lot! > > Dimitri > > On Wed, Feb 11, 2009 at 12:46 PM, Sundar Dorai-Raj <sdorai...@gmail.com> > wrote: >> Pass a list to xlab and main for the font sizes: >> >> barchart(..., xlab = list("x-axis", cex = 2), main = list("title", cex = 2)) >> >> For value labels and a grid you'll need a custom panel function: >> >> barchart(..., panel = function(x, y, ...) { >> panel.barchart(x, y, ...) >> panel.text(x, y, format(y), cex = 1.2) >> panel.grid(h = -1, v = -1) >> }) >> >> This is untested, but I think it should get you started. >> >> --sundar >> >> On Wed, Feb 11, 2009 at 9:10 AM, Dimitri Liakhovitski <ld7...@gmail.com> >> wrote: >>> Hello! >>> >>> I apologize - I never used lattice before, so my question is probably >>> very basic - but I just can't find the answer in the archive nor in >>> the documentation: >>> >>> I have a named numeric vector p of 6 numbers (of the type 6 numbers >>> with people's names to whom those numbers belong). I want a simple bar >>> chart. >>> >>> I am doing: >>> >>> library(lattice) >>> trellis.par.set(fontsize=list(text=12)) # Changes only axes font >>> barchart(~sort(p),main="Text for main",xlab="Text for X axis", >>> col=PrimaryColors[3]) >>> >>> It works just fine. >>> Question: Where how can I change such things as font size for X axis >>> label (below the numbers), font size for Title, value labels (to label >>> bars with actual numbers), add grids, etc.? >>> >>> Thanks a lot! >>> >>> -- >>> Dimitri Liakhovitski >>> MarketTools, Inc. >>> dimitri.liakhovit...@markettools.com >>> >>> ______________________________________________ >>> R-help@r-project.org 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. >>> >> > > > > -- > Dimitri Liakhovitski > MarketTools, Inc. > dimitri.liakhovit...@markettools.com > ______________________________________________ R-help@r-project.org 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.