plotly / plotly/plotly.py

Sunburst plots override font size and don't position unreadable labels outside

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

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

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

Hi everyone,

just discovered sunburst plots and am loving them! Besides the problem of text orientation that is momentarily being solved, I am wondering why it is possible to style outsidetextfont but not possible to actually place text outside the chart (at least for the last level). Similarly to pie charts, I would expect to find a textposition = 'outside' parameter. At the moment, for tiny wedges, the labels are being squeezed in no matter what, ignoring the font sizes given in insidetextfont AND textfont. Example:

import plotly.graph_objects as go
data = pd.DataFrame.from_dict({'key': {0: '#iii',
  1: '#vi',
  2: 'I',
  3: 'III',
  4: 'V',
  5: 'bII',
  6: 'i',
  7: 'ii',
  8: 'iii',
  9: 'iv',
  10: 'v',
  11: 'major',
  12: 'minor'},
 'duration': {0: 4.0,
  1: 12.0,
  2: 85.0,
  3: 202.0,
  4: 4.0,
  5: 4.5,
  6: 655.0,
  7: 5.0,
  8: 4.0,
  9: 33.5,
  10: 54.5,
  11: 295.5,
  12: 768.0},
 'parent': {0: 'minor',
  1: 'minor',
  2: 'major',
  3: 'major',
  4: 'major',
  5: 'major',
  6: 'minor',
  7: 'minor',
  8: 'minor',
  9: 'minor',
  10: 'minor',
  11: '',
  12: ''}})
fig =go.Figure(go.Sunburst(
    labels=data.key,
    parents=data.parent,
    values=data.duration,
    branchvalues="total", 
    textfont = {'size': 20},
    insidetextfont = {'size': 20},
    textinfo = "label+percent parent",
    #textposition='outside' <-- this option is missing
    ))
fig.show()

sunburst

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

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

はじめの一歩

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

調査の方向性

まず、提供されている Python の再現コードを go.Sunburst で実行し、issue で言及されている pie-chart の挙動と、ラベルの配置およびフォントサイズの挙動を比較します。sunburst のラベルオプションを追跡し、外側への配置、小さなウェッジ、textfont/insidetextfont に対して期待される挙動を判断します。報告された例で、要求されたオプションとサイズ調整の挙動が機能すれば完了です。

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

評価

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

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

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