Skip to content

Commit f0a9596

Browse files
tweaks
1 parent 2658105 commit f0a9596

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Diff for: doc/python/creating-and-updating-figures.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ This is a perfectly valid way to use `plotly.py` to build figures. On the other
8585

8686
As an alternative to working with Python dictionaries, the `plotly.py` graphing library provides a hierarchy of classes called "graph objects" that may be used to construct figures. Graph objects have several benefits compared to plain Python dictionaries.
8787

88-
1. Graph objects provide precise data validation. If you provide an invalid property name or an invalid property value as the key to a graph object, an exception will be raised with a helpful error message describing the problem. This is not the case if you use plain Python dictionaries and lists to build your figures.
88+
1. Graph objects provide precise data validation. If you provide an invalid property name or an invalid property value as the key to a graph object, an exception will be raised with a helpful error message describing the problem. This is not the case if you use plain Python dictionaries and lists to build your figures.
8989

90-
2. Graph objects contain descriptions of each valid property as Python `docstrings`. You can use these `docstrings` in the development environment of your choice to learn about the available properties as an alternative to consulting the online _Full Reference_.
90+
2. Graph objects contain descriptions of each valid property as Python `docstrings`. You can use these `docstrings` in the development environment of your choice to learn about the available properties as an alternative to consulting the online [Full Reference](/python/reference/).
9191

92-
3. Properties of graph objects can be accessed using both dictionary-style key lookup (e.g. `fig["layout"]`) or class-style property access (e.g. `fig.layout`).
92+
3. Properties of graph objects can be accessed using both dictionary-style key lookup (e.g. `fig["layout"]`) or class-style property access (e.g. `fig.layout`).
9393

94-
4. Graph objects support higher-level convenience functions for making updates to already constructed figures, as described below.
94+
4. Graph objects support higher-level convenience functions for making updates to already constructed figures, as described below.
9595

9696
**Graph objects are stored in a hierarchy of modules under the `plotly.graph_objects` package, so make sure to remember to `import plotly.graph_objects as go` when you want to use them.**
9797

@@ -136,21 +136,22 @@ import plotly.graph_objects as go
136136

137137
fig = go.Figure(
138138
data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])],
139-
layout=go.Layout(
140-
title=go.layout.Title(text="Converting Graph Objects To Dictionaries and JSON")
141-
)
139+
layout=go.Layout(height=600, width=800)
142140
)
143141

144-
print("Dictionary Representation of A Graph Object:\n" + str(fig.to_dict()))
142+
fig.layout.template = None # to slim down the output
145143

146-
print("\n\nJSON Representation of A Graph Object:\n" + str(fig.to_json()))
144+
print("Dictionary Representation of A Graph Object:\n\n" + str(fig.to_dict()))
145+
print("\n\n")
146+
print("JSON Representation of A Graph Object:\n\n" + str(fig.to_json()))
147+
print("\n\n")
147148
```
148149

149150
### Creating Figures
150151

151152
This section summarizes several ways to create new graph object figures with the `plotly.py` graphing library.
152153

153-
#### Constructor
154+
#### Graph Objects `Figure` Constructor
154155

155156
As demonstrated above, you can build a complete figure by passing trace and layout specifications to the `plotly.graph_objects.Figure` constructor. These trace and layout specifications can be either dictionaries or graph objects.
156157

0 commit comments

Comments
 (0)