Skip to content

changing settings on a barchart (lattice)

2 messages · Dimitri Liakhovitski, Sundar Dorai-Raj

#
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 <sdorairaj at gmail.com> wrote:

  
    
#
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 <ld7631 at gmail.com> wrote: