Try this:

nm <- c('Conduct Disorders','Attention Deficit', 'Eating
Disorders','Substance Abuse','Developmental Disorders')
barplot(dd, names.arg = gsub(" ", "\n", nm))

On Wed, Oct 29, 2008 at 4:43 PM, Udo <ukoenig@med.uni-marburg.de> wrote:

> 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
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

