[R] label_wrap_gen question
Brian Diggs
diggsb at ohsu.edu
Tue Aug 7 17:17:15 CEST 2012
On 8/6/2012 9:07 PM, vd3000 wrote:
> Hi, all
>
> I am trying to use the label_wrap_gen function in this website.
> https://github.com/hadley/ggplot2/wiki/labeller
> I tried to make a long name like this
>
> Light and heavy good vehicles (diesel) -\nGVX
>
> f2 = facet_grid(vehicle ~ ., labeller=label_wrap_gen(width=15))
>
> eventually, I got something like this in my label...
> *Light and heavy
> good vehicles
> (diesel) - GVX*
> I suppose the "-n" could break GVX to the next row but it failed...
> Is it a bug? or it has been overpowered by "width=15"?? so "-n" could not
> function well?
>
> Eventually I tried f2 = facet_grid(vehicle ~.)
>
> The "-n" did work and I got
> *Light and heavy good vehicles (diesel) -
> GVX*
>
> But it also failed because I could not show all the label properly...
>
> Anyone has idea about this?
> It is freaking me out~ I am sorry I am stupid on R
> Thanks in advance.
>
> VD
label_wrap_gen uses strwrap to do the "heavy lifting" of figuring out
how to actually split the text into lines. From the help page of
strwrap, "Whitespace (space, tab or newline characters) in the input is
destroyed.", so this is documented behavior. I don't see an option to
strwrap to suppress this behavior.
> --
> View this message in context: http://r.789695.n4.nabble.com/label-wrap-gen-question-tp4639364.html
> Sent from the R help mailing list archive at Nabble.com.
>
--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University
More information about the R-help
mailing list