title_font broken within template layouts

Aperta
#3,580 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
jupyter-notebook, python

Direzione di ricerca

Esegui l’esempio Python fornito in Jupyter e confronta la figura basata su un template con l’esempio diretto di update_layout. Segui pio.to_templated, pio.templates e i percorsi di layout di title_font/title.font per trovare il motivo per cui il template non mantiene il carattere. Il lavoro è completato quando l’esempio del template visualizza il titolo in Times New Roman e l’esempio della documentazione collegato torna a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug P3

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!

Lingua principale
Python
Stelle
18.8k
Fork
2.8k
Merge medio
16h 26m
PR unite (30g)
21

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di plotly/plotly.py

Tutte le issue di plotly/plotly.py

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.