plotly / plotly/plotly.R

geom_GeomLabelRepel() to be implemented

オープン
#1,972 コメント 4 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
R
スター
2.7k
フォーク
641
PR マージ指標
30日以内にマージされた PR はありません

説明

I have a graph, made with ggplot, with three labels, each for one variable, but when I try to make it dinamic by using the function ggplotly, I get a warning since the geom geom_label_repel is not implemented yet in plotly.

I copy the script of my graph and the warning I get:

# g1 <- tabla1 %>% ggplot()+
  geom_hline(yintercept = 0, color = "grey", alpha =0.7, size = 0.5) +
  geom_line(aes(Fecha, Cobros),
            size = 1, color = cols_arg) +
  geom_point(aes(Fecha, Cobros),
             size = 2, color = cols_arg) +
  geom_line(aes(Fecha, Pagos),
            size = 1, color = cols_arg2[1]) +
  geom_point(aes(Fecha, Pagos),
             size = 2, color = cols_arg2[1]) +
  geom_col(aes(Fecha, Balanza, fill = color_bza)) +
  scale_fill_manual(values = c("deficit" = cols_arg2[6],
                               "superavit" = cols_arg2[2])) +
  scale_x_date(limits = c(min(tabla1$Fecha),max(tabla1$Fecha)+months(6)),
               date_breaks = "1 months", 
               date_labels = "%b%y", 
               expand = c(0,10))+
  labs(title="xxx",subtitle = "...",x="",y="",
       caption="xxx")+
  theme_minimal() +
  ggrepel::geom_label_repel(data = filter(ungroup(tabla1), Fecha == max(Fecha)),
                            aes(Fecha, Cobros, label = "Cobros"),
                            nudge_x = 30,
                            na.rm = TRUE,
                            size=4,
                            segment.colour = "transparent",
                            color=cols_arg) +
  ggrepel::geom_label_repel(data = filter(ungroup(tabla1), Fecha == max(Fecha)),
                            aes(Fecha, Pagos, label = "Pagos"),
                            nudge_x = 30,
                            na.rm = TRUE,
                            size=4,
                            segment.colour = "transparent",
                            color=cols_arg2[1]) +
  ggrepel::geom_label_repel(data = filter(ungroup(tabla1), Fecha == max(Fecha)),
                            aes(Fecha, Balanza, label = "Balanza"),
                            nudge_x = 40,
                            na.rm = TRUE,
                            size=4,
                            segment.colour = "transparent",
                            color=cols_arg2[6])+
  theme(
    text = element_text(family = familia_fuente), 
    plot.title    = element_markdown(size = 10),
    plot.subtitle = element_markdown(size = 8),
    plot.caption  = element_markdown(size = 6),
    strip.text.y  = element_text(size = 8, face = "bold"),
    axis.text.x   = element_text(size = 6,angle=90),
    axis.text.y   = element_text(size = 8),
    panel.grid.minor.x = element_blank(),
    legend.position = "none",
    strip.placement = "outside")

g1 <- ggplotly(g1) %>%
   layout(hovermode = "x")
g1

THE WARNING MESSAGE:
Warning messages:
1: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomLabelRepel() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
2: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomLabelRepel() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
3: In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomLabelRepel() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、提供されている ggplotly の例を ggrepel::geom_label_repel() で再現し、geom2trace.default の警告を調査します。geom_GeomLabelRepel() が警告なしで変換され、結果の plotly グラフに 3 つのラベルが描画されれば作業完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
r
領域
data-visualization
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。