Skip to content

Add missing imports and variable definitions #5302

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

Open
wants to merge 1 commit into
base: doc-prod
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions doc/python/3d-mesh.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Whereas the previous example used the default `intensitymode='vertex'`, we plot

```python
import plotly.graph_objects as go
import numpy as np

fig = go.Figure(data=[
go.Mesh3d(
# 8 vertices of a cube
Expand Down
4 changes: 3 additions & 1 deletion doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The PX `labels` argument can also be used without a data frame argument:

```python
import plotly.express as px
fig = px.bar(df, x=["Apples", "Oranges"], y=[10,20], color=["Here", "There"],
fig = px.bar(x=["Apples", "Oranges"], y=[10,20], color=["Here", "There"],
labels=dict(x="Fruit", y="Amount", color="Place")
)
fig.show()
Expand Down Expand Up @@ -460,6 +460,7 @@ Here, `ticklabelstandoff=15` moves the labels 15 pixels further away from the x-

```python
import plotly.express as px
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')

Expand Down Expand Up @@ -487,6 +488,7 @@ To draw the label for the minor tick before each major tick, set `ticklabelindex

```python
import plotly.express as px
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')

Expand Down
1 change: 1 addition & 0 deletions doc/python/box-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ fig.show()

```python
import plotly.graph_objects as go
import numpy as np

x_data = ['Carmelo Anthony', 'Dwyane Wade',
'Deron Williams', 'Brook Lopez',
Expand Down
3 changes: 3 additions & 0 deletions doc/python/creating-and-updating-figures.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ fig.show()
The `plotly.subplots.make_subplots()` function produces a graph object figure that is preconfigured with a grid of subplots that traces can be added to. The `add_trace()` function will be discussed more below.

```python
import plotly.graph_objects as go
from plotly.subplots import make_subplots

fig = make_subplots(rows=1, cols=2)
Expand Down Expand Up @@ -260,6 +261,7 @@ fig.show()
If a figure was created using `plotly.subplots.make_subplots()`, then supplying the `row` and `col` arguments to `add_trace()` can be used to add a trace to a particular subplot.

```python
import plotly.graph_objects as go
from plotly.subplots import make_subplots

fig = make_subplots(rows=1, cols=2)
Expand All @@ -274,6 +276,7 @@ This also works for figures created by Plotly Express using the `facet_row` and

```python
import plotly.express as px
import plotly.graph_objects as go

df = px.data.iris()

Expand Down
1 change: 1 addition & 0 deletions doc/python/imshow.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ fig.show()
### Displaying an image and the histogram of color values

```python
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from skimage import data
img = data.chelsea()
Expand Down
2 changes: 2 additions & 0 deletions doc/python/network-graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ node_trace.text = node_text
#### Create Network Graph

```python
import plotly.graph_objects as go

fig = go.Figure(data=[edge_trace, node_trace],
layout=go.Layout(
title=dict(
Expand Down
2 changes: 2 additions & 0 deletions doc/python/ohlc-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ import plotly.graph_objects as go
import pandas as pd
from datetime import datetime

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')

hovertext=[]
for i in range(len(df['AAPL.Open'])):
hovertext.append('Open: '+str(df['AAPL.Open'][i])+'<br>Close: '+str(df['AAPL.Close'][i]))
Expand Down
1 change: 1 addition & 0 deletions doc/python/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ Combining themes is also supported by Plotly Express

```python
import plotly.io as pio
import plotly.graph_objects as go
import plotly.express as px

pio.templates["draft"] = go.layout.Template(
Expand Down
2 changes: 1 addition & 1 deletion doc/python/time-series.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ fig.show()
```

```python
import plotly.graph_objects as go
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')

Expand Down