plotly / plotly/plotly.R

legend positioning

Đang mở
#195 3 bình luận 2 reaction 1 người được giao Xem trên GitHub

@13bzhang đang làm issue này rồi.

Từ ngày 9/7/2015.

ggplotly
Ngôn ngữ chính
R
Star
2.7k
Fork
641
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

a lot of legends are coming out with weird positioning (https://github.com/ropensci/plotly/issues/194#issuecomment-87780687)

a couple things to work out:

  • move the horizontal position of the legend to the right more

    layout$legend$x <- 1.0 # move it to the right a bit
    layout$legend$xanchor <- "left" 
    layout$annotation[[1]]$x <- 1.01
    layout$annotation[[1]]$xanchor <- "left"
    
  • the vertical position of the legend should stay in the middle, with yanchor <- "middle"

    layout$legend$y <- 0.5 # page middle
    layout$legend$yanchor <- "middle" 
    

    but we should compute the vertical position of the legend title annotation to remain above the legend, no matter how many entries. For now, we could hardcode a mapping in that would work for default font-sizes:

    • 8 legend entries: annotation$y <- 0.65 (from manual inspection)
    • 1 legend entry: annotation$y <- 0.52 (manual inspection)
    • -> annotation$y <- 0.14125 * number_of_legend_items - 0.48 (computed from those two points above)

    @alexcjohnson, how do you think legend titles will work in the future? a separate attribute inside legend?

  • manual legend positions from ggplot: https://github.com/ropensci/plotly/blob/add-r-cookbook-tests/tests/cookbook-test-suite/legends.R#L109-L122

cc @tdhock , @cpsievert

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.