Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving integration of Plotly.js templates (themes) #1161

Closed
jonmmease opened this issue Sep 6, 2018 · 1 comment
Closed

Improving integration of Plotly.js templates (themes) #1161

jonmmease opened this issue Sep 6, 2018 · 1 comment
Milestone

Comments

@jonmmease
Copy link
Contributor

Some notes on integrating the new template (theme) support from plotly/plotly.js#2761 (original discussion from #924). With just rerunning code generation, in plotly.py 3.1+ template support is already usable. For example:

fig = go.FigureWidget()
fig.layout.template = {
    'layout': {'paper_bgcolor': 'lightgray'},
    'data': {'scatter': [{'mode': 'markers',
                          'marker': {'size': 20, 'symbol': 'square'}},
                         {'mode': 'markers',
                          'marker': {'size': 20, 'symbol': 'triangle'}},
                        ]}}
fig.add_scatter(y=[3, 1, 3])
fig.add_scatter(y=[1, 3, 2])
fig

newplot

Here are some of my thoughts for improving the integration for plotly.py users:

  • Write a custom validator for layout.template (right now it accepts anything and Plotly.js just ignores invalid properties)
  • Include some way to set a global template that is the default unless if it overridden in the constructor. Support saving this default to a ~/.plotly settings file.
  • Include a set of predefined named templates (like @sglyon did in WIP: adding themes #924).
  • Figure out what's going on with the new name and templateitemname properties that were added to all of the object array properties (e.g. annotations, images, etc.). I think the name properties should only show up in the template hierarchy and templateitemname should only show up in the normal object hiererahcy.
@jonmmease jonmmease mentioned this issue Sep 6, 2018
3 tasks
@jonmmease jonmmease added this to the v3.4.0 milestone Oct 8, 2018
@jonmmease
Copy link
Contributor Author

jonmmease commented Oct 24, 2018

Done in #1224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant