[R] R ggplot2 legend text left justify

hadley wickham h.wickham at gmail.com
Tue Feb 9 15:23:34 CET 2010


Hi Paul,

That's a bug in the current version of ggplot.  I'm working on update
for later this week.

Hadley

On Mon, Feb 8, 2010 at 5:56 PM, Paul Sutcliffe <psutclif at it.uts.edu.au> wrote:
>
>
> In ggplot2 how do you justify the legend text ?
> In the example below the opts(legend.text = theme_text(size = 9,hjust=0))
>  changes the size of the text OK but it remains right justified.
>
>
>> mydata=data.frame(RowID=c("A","B","C"),Name=c("long long long long long
>> name","short name ","medium medium name"),Speed=c(100,140,120))
>> mydata
>  RowID                          Name Speed
> 1     A long long long long long name   100
> 2     B                   short name    140
> 3     C            medium medium name   120
>> ggplot(mydata, aes(RowID,Speed))+ opts(legend.text = theme_text(size =
>> 9,hjust=0)) + geom_bar() + xlab("Name") + aes(colour = Name) +aes(fill=Name)
>>
>
> Thank in advance
> Paul
>
>
> --
> Dr. Paul J Sutcliffe
>
>
> Casual Academic
> Faculty of Engineering and IT, University of Technology, Sydney (UTS) email:
> psutclif at it.uts.edu.au
> http://www-staff.it.uts.edu.au/~psutclif/
> CRICOS Provider Code 00099F
>
> ______________________________________________
> R-help at 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.
>



-- 
http://had.co.nz/



More information about the R-help mailing list