ropensci/plotly — pull request #143 by pedrodz (2014-11-12 16:45:34+00:00)
Title: ggplot: legend: Improve title position

This PR is to tackle https://github.com/ropensci/plotly/pull/142#issuecomment-62310471

Summary:

- Legend: `xanchor=center`, `yanchor=top`
- Legend title (annotation): `xanchor=center`

With `xanchor` `center`, legend was on top of plot. Legend `x` position (unfortunately) had to be hard-coded to `1.04`. If `x` position is not hard-coded: https://plot.ly/~pdespouy/2211/total-bill-vs-time/
With large number of variables, legend skews to the bottom, see https://plot.ly/~pdespouy/2209/posttest-vs-pretest/

Examples:

With 2 variables un-merged, before PR: https://plot.ly/~pdespouy/2203/total-bill-vs-time/
With 2 variables un-merged, after PR: https://plot.ly/~pdespouy/2207/total-bill-vs-time/

With 2 variables, before PR: https://plot.ly/~pdespouy/2204/rating-vs-cond/
With 2 variables, after PR: https://plot.ly/~pdespouy/2208/rating-vs-cond/

With 9 variables, before PR: https://plot.ly/~pdespouy/2205/posttest-vs-pretest/
With 9 variables, after PR: https://plot.ly/~pdespouy/2209/posttest-vs-pretest/

With 3 variables, before PR: https://plot.ly/~pdespouy/2206/weight-vs-group/
With 3 variables, after PR: https://plot.ly/~pdespouy/2210/weight-vs-group/