[R] Barplot: Vertical bars with long labels

Udo ukoenig at med.uni-marburg.de
Wed Oct 29 19:43:27 CET 2008


Dear List,
I need a barplot with vertical bars. Each bar should have a label.
The problem is, that the labels are too long, so they overlap, or
only every seccond label is displayed in the output.

Here is a little syntax:

dd <- c(100,110,90,105,95)
barplot(dd,names.arg=c('Conduct Disorders','Attention Deficit',
                       'Eating Disorders',
                       'Substance Abuse','Developmental Disorders'))

My question is, if there is a chance to force a line break in each label.

The result shoud look like this:

  Bar1        Bar2       Bar3         Bar4         Bar5
Conduct    Attention    Eating     Substance   Developmental
Disorders  Disorders   Disorders     Abuse        Disorders



The result could also look like this:

      Bar1         Bar2       Bar3         Bar4         Bar5
       |            |          |            |             |
Conduct Disorders   |    Eating Disordes    |    Developmental Disordes
                    |                       |
             Attention deficit       Substance Abuse




Many thanks in advance
Udo



--------------------------------------------
Udo K    N     G
      Ö     I

Clinic for Child an Adolescent Psychiatry
Philipps University of Marburg / Germany



More information about the R-help mailing list