Hi Dennis,

Yes indeed. But when I apply panel.text then the text is not nicely centered
in each bar.

KR,
Ashraf

On Wed, Nov 10, 2010 at 3:31 AM, Dennis Murphy <djmuser@gmail.com> wrote:

> Hi:
>
> Did you mean
>
> panel.text(x,y/2,label = round(y,3),cex=1)
>
> ??
>
> HTH,
> Dennis
>
>   On Tue, Nov 9, 2010 at 1:11 AM, Ashraf Yassen <ashraf.yassen@gmail.com>wrote:
>
>>  Dear All,
>>
>> Now with data. Any suggestion how to center the text in the filling would
>> be
>> appreciated.
>>
>> Kind regards,
>> Ashraf
>>
>> library(lattice)
>> a<-c(100,100,93.57,50,0,0,6.43,50)
>> b<-c(1,1,1,1,0,0,0,0)
>>
>> VISIT<-c(1,2,3,4,1,2,3,4)
>> VISIT<-as.character(VISIT)
>> stuffd<-data.frame(FREQ=a, VISIT=VISIT, RES=b)
>>
>> barchart(FREQ~VISIT, data = stuffd,par.strip.text = list(cex = 0.35),
>> groups = RES, xlab="Visit",ylab="Frequency",
>> layout = c(1,1),
>>
>> par.settings=list(superpose.polygon=list(col=colors()[c(636,96,256,92,27,376)])),
>> stack = T,
>> auto.key = list(points = FALSE, rectangles = TRUE,
>> space = "top"),
>> scales = list(x = list(alternating=c(1,1),tck=c(1,0),abbreviate = TRUE,
>> minlength
>> = 5, rot = 0),y=list(alternating=c(1,1),tck=c(1,0))),
>> panel = function(y,x,...){
>> panel.grid(h = -1, v = 0, col = "gray", lty = 3,lwd=1)
>> panel.barchart(x,y,...)
>> panel.text(x,y,label = round(y,3),cex=1)
>> }
>> )
>>
>>
>> On Mon, Nov 8, 2010 at 4:37 PM, RICHARD M. HEIBERGER <rmh@temple.edu>
>> wrote:
>>
>> > Please post some data (fake data is fine) for stuffa.  The example
>> doesn't
>> > execute as is.
>> >
>> > Rich
>> >
>> >
>> >
>> >   On Mon, Nov 8, 2010 at 10:27 AM, Ashraf Yassen <
>> ashraf.yassen@gmail.com>wrote:
>> >
>> >>  Hi All,
>> >>
>> >> I need some help in putting text in a stacked barplot. The barplot is
>> >> filled
>> >> with 5 levels and now I would like to put text to each level in the
>> >> stacked
>> >> barplot. However, it seems that the code that I am using is not placing
>> >> the
>> >> text at the correct hight (centered at each fill) in the barplot. Any
>> >> suggestions to improve the code to make it work?
>> >>
>> >> barchart(FREQ ~ VISIT |which*as.factor(TRTN), data =
>> stuffa,par.strip.text
>> >> =
>> >> list(cex = 0.35),
>> >> groups = RES, xlab="Visit",ylab="Frequency",
>> >> layout = c(4,2),
>> >>
>> >>
>> par.settings=list(superpose.polygon=list(col=colors()[c(636,96,256,92,27,376)])),
>> >> stack = T,
>> >> auto.key = list(points = FALSE, rectangles = TRUE,
>> >> space = "top"),
>> >> scales = list(x = list(alternating=c(1,1),tck=c(1,0),abbreviate = TRUE,
>> >> minlength
>> >> = 5, rot = 0),y=list(alternating=c(1,1),tck=c(1,0))),
>> >> panel = function(y,x,...){
>> >> panel.grid(h = -1, v = 0, col = "gray", lty = 3,lwd=1)
>> >> panel.barchart(x,y,...)
>> >> panel.text(x,y,label = round(y,1),cex=0.48)
>> >> }
>> >> )
>> >>
>> >>
>> >>
>> >> Kind regards,
>> >> Ashraf Yassen
>> >>
>> >>        [[alternative HTML version deleted]]
>> >>
>> >> ______________________________________________
>> >> 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<http://www.r-project.org/posting-guide.html>
>> <http://www.r-project.org/posting-guide.html>
>>
>> >> and provide commented, minimal, self-contained, reproducible code.
>> >>
>> >
>> >
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

	[[alternative HTML version deleted]]

