plotly / plotly/plotly.R

geom_xspline not implemented in plotly - getting error message when using ggplotly() function

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

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

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

説明

I get an error message when trying to implement geom_xspline with
plotly.

I get the desired graph in ggplot2 but the plot cannot be converted to a
plotly object when using the ggplotly function.
You can find the code showcasing this below.

library(pacman)
pacman::p_load(tidyverse, datasets, plotly, ggplotly, ggalt)
# airmiles built-in dataset: 
airmiles <- datasets::airmiles
year <- 1937:1960
airmiles <- data.frame(year = year, airmiles = airmiles)


# "line" plot using geom_xspline from ggalt package: 
plot_airmiles <- ggplot(data = airmiles, 
              aes(x = year, y = airmiles)) + 
  geom_point(alpha = 0.75) + 
  geom_xspline(spline_shape = -0.7) +
  scale_y_continuous(n.breaks = 10) 

plot_airmiles

Image

# interactive plot: using ggplotly doesn't work
ggplotly(plot_airmiles)

Image

Could this be implemented in plotly? Is there any way I can still
produce the interactive graph in plotly without waiting for this to be
implemented?

The plotly documentation (https://linking.plotly-r.com/custom-geoms)
mentions the possibility of creating custom geoms and using the
to_basic() function from the plotly package to “convert” the custom geom
into a geom plotly understands.
In the link above, the authors provide an example for geom_xspline
specifically but their method and code don’t work unfortunately.

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

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

はじめの一歩

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

調査の方向性

提供された airmiles の例、geom_xspline、ggplotly() を使って失敗を再現します。issue にリンクされている custom-geoms のドキュメントを読み、そこに記載されている to_basic() アプローチを調べます。geom_xspline を plotly オブジェクトに変換できるようになるか、サポートされる制限と回避策が文書化されれば完了です。

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

評価

技術スタック
r
領域
data-visualization
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

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

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