Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Theming chapter#28

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jonmmease merged 9 commits intomasterfromtemplates
Jun 27, 2019
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
magic underscore notation and notes
  • Loading branch information
@jonmmease
jonmmease committedJun 23, 2019
commit715170815b4efb767eabc326ee95897dff6d7d6f
6 changes: 5 additions & 1 deletionnotebooks/templates.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -125,7 +125,7 @@ Here is an example that creates a template that sets the default title font to s
import plotly.graph_objects as go

large_rockwell_template = go.layout.Template(
layout=go.Layout(dict(title=dict(font=dict(family="Rockwell", size=24))))
layout=go.Layout(title_font=dict(family="Rockwell", size=24))
)

fig = go.Figure()
Expand All@@ -134,6 +134,8 @@ fig.update_layout(title="Figure Title",
fig.show()
```

> Note: this example uses magic underscore notation to write `go.Layout(title=dict(font=dict(...)))` as `go.Layout(title_font=dict(...))`

### The template data property
The `data` property of a template is used to customize the default values of the properties of traces that are added to a figure that the template is applied to. This `data` property holds a graph object, with type `go.layout.template.Data`, that has a property named after each supported trace type. These trace type properties are then assigned lists or tuples of graph object traces of the corresponding type.

Expand DownExpand Up@@ -297,6 +299,8 @@ fig.update_layout(template="draft")
fig.show()
```

> Note: this example uses magic underscore notation to write `go.layout.Template(layout=dict(annotations=[...]))` as ``go.layout.Template(layout_annotations=[...])`

It is also possible to set your own custom template as the default so that you do not need to pass it by name when constructing graph object figures or calling plotly express functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Github's syntax highlighting is confused about this block... does it render OK in Jupyter?


```python
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp