Error on shape editing with `dcc.Graph`: Invalid property specified for object of type plotly.graph_objs.layout.shape.label: 'texttemplate'
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
I use dash components in my Flask app to render shapes on a dcc.Graph figure input. Oftentimes, this involves appending a list of shapes to the graph using the formula below:
for center in center_list:
center = region.centroid
annotation = cluster_frame[cluster_frame['cell_id'] == mask_id]['cluster']
if len(annotation) > 0:
annotation = str(annotation.tolist()[0])
# boundary[int(center[0]), int(center[1])] = mask_id
shapes.append(
{'editable': False, 'line': {'color': 'white'}, 'type': 'circle',
'x0': (int(center[1]) - circle_size), 'x1': (int(center[1]) + circle_size),
'xref': 'x', 'y0': (int(center[0]) - circle_size), 'y1': (int(center[0]) + circle_size),
'yref': 'y',
'fillcolor': cluster_assignments[data_selection][annotation]})
self.figure['layout']['shapes'] = shapes
In the example above, a series of circles are generated around centroids for objects in the graph.
This scheme generally works well, but occasionally there will be in the following error when calling go.Figure(self.figure):
Invalid property specified for object of type plotly.graph_objs.layout.shape.label: 'texttemplate'
When I evaluate the shapes, sometimes they have a strange property added to them:
{'editable': False, 'line': {'color': 'white'}, 'type': 'circle', 'x0': 763, 'x1': 779, 'xref': 'x', 'y0': 284, 'y1': 300, 'yref': 'y', 'label': {'texttemplate': ''}}
It appears that plotly will randomly generate the label portion of the shape dictionary with a blank text template, which causes an error. It seems to happen indiscriminately and without a discernible pattern.
By comparison, most shapes appear to have a valid dictionary structure:
{'editable': True, 'line': {'color': 'white'}, 'type': 'circle', 'x0': 796, 'x1': 812, 'xref': 'x', 'y0': 293, 'y1': 309, 'yref': 'y'}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
go.Figure(self.figure) の呼び出しから始め、shape の辞書がどのように plotly.graph_objs.layout.shape.label に渡るかを調べてください。提供された円形の shape で再現し、label.texttemplate がある場合とない場合を比較してください。示された入力で、報告された断続的な invalid-property エラーの原因が説明され、発生しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- flask, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100