[R] Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question

Dimitri Liakhovitski ld7631 at gmail.com
Thu May 21 23:21:04 CEST 2009


Thank you very much, Deepayan!

On Thu, May 21, 2009 at 4:49 PM, Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
> On Thu, May 21, 2009 at 12:58 PM, Dimitri Liakhovitski <ld7631 at gmail.com> wrote:
>
>> Deepayan, thank you very much for your response.
>> I have a general question. And please remember - I am really just a
>> beginner in R.
>> Is it truly the case that in order to build quite a basic bar chart
>> with value labels attached to it I have to be a true R graphics guru -
>> because the only way to do achieve what I am trying to achive is to
>> modify the underlying R function (panel.barchart)?
>> Really?
>
> That's one way to look at it. The other interpretation is that the
> author(s) of the functions you tried to use do not consider what you
> are doing "basic".
>
> If you are interested in simpler alternatives, I would suggest something like
>
> barchart(Group ~ Percentage | factor(a), test, origin = 0,
>         panel = function(x, y, ...) {
>             panel.grid(h = 0, v = -1)
>             panel.barchart(x, y, ...)
>             ltext(x, y, labels=round(x, 0),
>                   cex=.7, col="black", font=2, pos=4)
>         })
>
> -Deepayan
>



-- 
Dimitri Liakhovitski
MarketTools, Inc.
Dimitri.Liakhovitski at markettools.com




More information about the R-help mailing list