plotly / plotly/plotly.R

Supporting arrows with add_segments in plot_geo

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

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

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

説明

I like how the line is showing as curved when using add_segments in plot_geo.
However, using plot_geo, it is difficult to show the movement/direction.
Would it be possible to draw curved arrows instead of curved lines?
I tried adding triangular markers at the end of the line, but this looks ugly since triangles are not oriented correctly:
image

I was hoping we could get something like this except with curved arrows:
image

Here is the code I used to generate the first plot:

library(plotly)
library(dplyr)

flights <- read.csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_aa_flight_paths.csv')
flights$id <- seq_len(nrow(flights))

geo <- list(
  scope = 'world',
  projection = list(type = 'equirectangular'),  #equirectangular, natural earth, orthographic, kavrayskiy7, miller
  showland = TRUE,
  showcountries = TRUE,
  landcolor = toRGB("gray95"),
  countrycolor = toRGB("gray80")
)

p <- plot_geo(
  locationmode = 'USA') %>%
  layout(geo = geo) %>%
  add_segments(
    data = flights, 
    x = ~start_lon, xend = ~end_lon,
    y = ~start_lat, yend = ~end_lat,
    alpha = 0.3,
    color = ~airport2,
    size = I(2.5),
    hoverinfo = "none"
  ) %>%
  add_markers(
    # data = my_segments %>% 
    #   filter(Family == fam & Units != 0 & From != To),
    data = flights, 
    x = ~end_lon,
    y = ~end_lat,
    color = ~airport2,
    size = 1,
    marker = list(symbol = 'triangle-up'),
    alpha = 1
  )

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

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

はじめの一歩

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

調査の方向性

提供された R の例を plot_geo と add_segments を使って再現し、曲線の飛行経路と終点マーカーを含めます。曲線セグメントがどのようにレンダリングされるか、また矢印のジオメトリがその方向に追従できるかを調査します。完了の条件は、plot_geo が正しく方向付けられた矢印の先端を持つ曲線矢印を表示できることです。

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

評価

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

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

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