[R] R ggplot2 legend text left justify

Paul Sutcliffe psutclif at it.uts.edu.au
Tue Feb 9 23:51:55 CET 2010


Thanks


hadley wickham wrote:

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



More information about the R-help mailing list