title_font broken within template layouts
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 18.8k
- Forks
- 2.8k
- Merge moyen
- 16 h 26 min
- PR mergées (30 j)
- 21
Description
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!
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Exécutez l’exemple Python fourni dans Jupyter et comparez la figure basée sur un template avec l’exemple direct de update_layout. Suivez pio.to_templated, pio.templates et les chemins de layout de title_font/title.font pour déterminer pourquoi le template ne conserve pas la police. La tâche est terminée lorsque l’exemple basé sur le template affiche le titre en Times New Roman et que l’exemple de documentation lié fonctionne à nouveau.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- jupyter-notebook, python
- Domaine
- data-visualization
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 42/100