plotly / plotly/plotly.py

title_font broken within template layouts

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

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

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

説明

Setting title font of a figure via templates has stopped working - including the example The template layout property which simply makes the title Rockwell in Size 24.

The example below should show (in Jupyter) a blank plot with a title in Times New Roman

import plotly.express as px
import plotly.io as pio
import plotly.graph_objs as go

# we create a figure with a layout, where we only change the title_font
fig = go.Figure(layout=dict(title_font=dict(family="Times New Roman", size=24)))

# create a test template
pio.templates["test_template"] = pio.to_templated(fig).layout.template

# show a blank plot with just a title to show the template won't pull in title_font data
px.line(title="This Should Be Times New Roman", template="test_template").show()

It doesn't make a difference if we use full dictionary or magic underscore notation

title=dict(font=dict(family="Times New Roman"))
title_font=dict(family="Times New Roman")

** However **

Updating the layout of a figure, not using the template, does still work, for example

# build fig with template
# use the fig.update_layout() to update title font in layout
# This will have a title in Times New Roman
fig = px.line(title="This IS Times New Roman", template="test_template")
fig = fig.update_layout(title_font={'family':'Times New Roman'}).show()

Thank you for a great tool!

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

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

はじめの一歩

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

調査の方向性

提供された Python の例を Jupyter で実行し、テンプレートベースの Figure と直接的な update_layout の例を比較します。pio.to_templated、pio.templates、および title_font/title.font の layout パスを追跡し、テンプレートがフォントを保持しない理由を特定します。テンプレートの例でタイトルが Times New Roman でレンダリングされ、リンクされたドキュメントの例が再び動作すれば完了です。

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

評価

技術スタック
jupyter-notebook, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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