diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 65f010f88..6c0bdb3e0 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -1,5 +1,6 @@
Doc upgrade checklist:
+- [ ] random seed is set if using random data
- [ ] file has been moved from `unconverted/x/y.md` to `x/y.md`
- [ ] old boilerplate at top and bottom of file has been removed
- [ ] Every example is independently runnable and is optimized for short line count
diff --git a/python/2D-Histogram.md b/python/2D-Histogram.md
index 8e2932fa9..b7f3f3d45 100644
--- a/python/2D-Histogram.md
+++ b/python/2D-Histogram.md
@@ -42,6 +42,7 @@ jupyter:
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
x = np.random.randn(500)
y = np.random.randn(500)+1
diff --git a/python/2d-histogram-contour.md b/python/2d-histogram-contour.md
index 08fbf75e3..0d46a6b00 100644
--- a/python/2d-histogram-contour.md
+++ b/python/2d-histogram-contour.md
@@ -42,6 +42,7 @@ jupyter:
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
x = np.random.uniform(-1, 1, size=500)
y = np.random.uniform(-1, 1, size=500)
diff --git a/python/3d-axes.md b/python/3d-axes.md
index 9782bec93..83b015121 100644
--- a/python/3d-axes.md
+++ b/python/3d-axes.md
@@ -48,6 +48,7 @@ For creating 3D charts, see [this page](https://plot.ly/python/3d-charts/).
```python
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
N = 70
diff --git a/python/annotated_heatmap.md b/python/annotated_heatmap.md
index 11014e846..e9b750df2 100644
--- a/python/annotated_heatmap.md
+++ b/python/annotated_heatmap.md
@@ -110,11 +110,12 @@ fig.show()
```python
import plotly.figure_factory as ff
import numpy as np
+np.random.seed(1)
z = np.random.randn(20, 20)
z_text = np.around(z, decimals=2) # Only show rounded value (full value on hover)
-fig = ff.create_annotated_heatmap(z, annotation_text=z_text, colorscale='Greys',
+fig = ff.create_annotated_heatmap(z, annotation_text=z_text, colorscale='Greys',
hoverinfo='z')
# Make text size smaller
@@ -183,7 +184,7 @@ z = [[.8, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, .0, 1.],
# Display element name and atomic mass on hover
hover=[]
for x in range(len(symbol)):
- hover.append([i + '
' + 'Atomic Mass: ' + str(j)
+ hover.append([i + '
' + 'Atomic Mass: ' + str(j)
for i, j in zip(element[x], atomic_mass[x])])
# Invert Matrices
@@ -208,4 +209,4 @@ For more info on Plotly heatmaps, see: https://plot.ly/python/reference/#heatmap
```python
help(ff.create_annotated_heatmap)
-```
\ No newline at end of file
+```
diff --git a/python/box-plots.md b/python/box-plots.md
index 94138c53c..aebdf6008 100644
--- a/python/box-plots.md
+++ b/python/box-plots.md
@@ -97,6 +97,7 @@ When data are not available as tidy dataframes, it is also possible to use the m
```python
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
y0 = np.random.randn(50) - 1
y1 = np.random.randn(50) + 1
diff --git a/python/click-events.md b/python/click-events.md
index b1eb674b0..c0d5163ec 100644
--- a/python/click-events.md
+++ b/python/click-events.md
@@ -43,6 +43,7 @@ jupyter:
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
x = np.random.rand(100)
y = np.random.rand(100)
diff --git a/python/compare-webgl-svg.md b/python/compare-webgl-svg.md
index 734b69f3b..0859b04f6 100644
--- a/python/compare-webgl-svg.md
+++ b/python/compare-webgl-svg.md
@@ -48,6 +48,7 @@ for increased speed, improved interactivity, and the ability to plot even more d
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
N = 75000
@@ -103,4 +104,4 @@ fig.show()
For more information see
`Scattergl()` : https://plot.ly/python/reference/#scattergl
-`Scatter()` : https://plot.ly/python/reference/#scatter
\ No newline at end of file
+`Scatter()` : https://plot.ly/python/reference/#scatter
diff --git a/python/custom-buttons.md b/python/custom-buttons.md
index ebb37a703..803ea410b 100644
--- a/python/custom-buttons.md
+++ b/python/custom-buttons.md
@@ -258,6 +258,7 @@ import plotly.graph_objects as go
# Generate dataset
import numpy as np
+np.random.seed(1)
x0 = np.random.normal(2, 0.4, 400)
y0 = np.random.normal(2, 0.4, 400)
diff --git a/python/dendrogram.md b/python/dendrogram.md
index b0f0e6378..0317f17f1 100644
--- a/python/dendrogram.md
+++ b/python/dendrogram.md
@@ -46,6 +46,7 @@ Dendrogram plots are commonly used in computational biology to show the clusteri
```python
import plotly.figure_factory as ff
import numpy as np
+np.random.seed(1)
X = np.random.rand(15, 12) # 15 samples, with 12 dimensions each
fig = ff.create_dendrogram(X)
@@ -183,4 +184,4 @@ fig.show()
```python
help(ff.create_dendrogram)
-```
\ No newline at end of file
+```
diff --git a/python/distplot.md b/python/distplot.md
index 6e9974d46..a465251af 100644
--- a/python/distplot.md
+++ b/python/distplot.md
@@ -71,6 +71,7 @@ A histogram, a kde plot and a rug plot are displayed.
```python
import plotly.figure_factory as ff
import numpy as np
+np.random.seed(1)
x = np.random.randn(1000)
hist_data = [x]
diff --git a/python/dropdowns.md b/python/dropdowns.md
index a5060734a..99b7f386d 100644
--- a/python/dropdowns.md
+++ b/python/dropdowns.md
@@ -256,6 +256,7 @@ import plotly.graph_objects as go
# Generate dataset
import numpy as np
+np.random.seed(1)
x0 = np.random.normal(2, 0.4, 400)
y0 = np.random.normal(2, 0.4, 400)
diff --git a/python/heatmaps.md b/python/heatmaps.md
index 1f3f6e785..b21473a60 100644
--- a/python/heatmaps.md
+++ b/python/heatmaps.md
@@ -123,13 +123,14 @@ fig.show()
import plotly.graph_objects as go
import datetime
import numpy as np
+np.random.seed(1)
programmers = ['Alex','Nicole','Sara','Etienne','Chelsea','Jody','Marianne']
base = datetime.datetime.today()
dates = base - np.arange(180) * datetime.timedelta(days=1)
z = np.random.poisson(size=(len(programmers), len(dates)))
-
+
fig = go.Figure(data=go.Heatmap(
z=z,
x=dates,
@@ -159,4 +160,4 @@ IFrame(src= "https://dash-simple-apps.plotly.host/dash-heatmapplot/code", width=
```
#### Reference
-See https://plot.ly/python/reference/#heatmap for more information and chart attribute options!
\ No newline at end of file
+See https://plot.ly/python/reference/#heatmap for more information and chart attribute options!
diff --git a/python/histograms.md b/python/histograms.md
index 09c0ea90d..605f8a7d5 100644
--- a/python/histograms.md
+++ b/python/histograms.md
@@ -138,6 +138,7 @@ When data are not available as tidy dataframes, it is also possible to use the m
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
x = np.random.randn(500)
diff --git a/python/images.md b/python/images.md
index b4554155a..d72404bec 100644
--- a/python/images.md
+++ b/python/images.md
@@ -149,6 +149,7 @@ fig.show()
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
from scipy.signal import savgol_filter
# Simulate spectroscopy data
diff --git a/python/line-and-scatter.md b/python/line-and-scatter.md
index d0637d39f..626dbd6fc 100644
--- a/python/line-and-scatter.md
+++ b/python/line-and-scatter.md
@@ -99,6 +99,7 @@ import plotly.graph_objects as go
# Create random data with numpy
import numpy as np
+np.random.seed(1)
N = 100
random_x = np.linspace(0, 1, N)
diff --git a/python/line-charts.md b/python/line-charts.md
index ec554ed62..f01fc5208 100644
--- a/python/line-charts.md
+++ b/python/line-charts.md
@@ -97,6 +97,7 @@ import plotly.graph_objects as go
# Create random data with numpy
import numpy as np
+np.random.seed(1)
N = 100
random_x = np.linspace(0, 1, N)
diff --git a/python/marker-style.md b/python/marker-style.md
index 1fd6512ec..798951c82 100644
--- a/python/marker-style.md
+++ b/python/marker-style.md
@@ -62,6 +62,7 @@ import plotly.graph_objects as go
# Generate example data
import numpy as np
+np.random.seed(1)
x = np.random.uniform(low=3, high=6, size=(500,))
y = np.random.uniform(low=3, high=6, size=(500,))
@@ -313,4 +314,4 @@ fig.show()
```
### Reference
-See https://plot.ly/python/reference/ for more information and chart attribute options!
\ No newline at end of file
+See https://plot.ly/python/reference/ for more information and chart attribute options!
diff --git a/python/orca-management.md b/python/orca-management.md
index d77353c41..2f6fa2be3 100644
--- a/python/orca-management.md
+++ b/python/orca-management.md
@@ -53,6 +53,7 @@ Now let's create a simple scatter plot with 100 random points of variying color
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
# Generate scatter plot data
N = 100
@@ -209,4 +210,4 @@ In addition to the `executable` property, the `plotly.io.orca.config` object can
### Saving Configuration Settings
-Configuration options can optionally be saved to the `~/.plotly/` directory by calling the `plotly.io.config.save()` method. Saved setting will be automatically loaded at the start of future sessions.
\ No newline at end of file
+Configuration options can optionally be saved to the `~/.plotly/` directory by calling the `plotly.io.config.save()` method. Saved setting will be automatically loaded at the start of future sessions.
diff --git a/python/random-walk.md b/python/random-walk.md
index ca32f997c..d57e0cc6a 100644
--- a/python/random-walk.md
+++ b/python/random-walk.md
@@ -47,6 +47,7 @@ The jitter in the data points along the x and y axes are meant to illuminate whe
```python
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
l = 100
steps = np.random.choice([-1, 1], size=l) + 0.05 * np.random.randn(l) # l steps
@@ -112,7 +113,7 @@ steps = np.random.choice([-1, 1], size=(N, l)) + 0.05 * np.random.standard_norma
position = np.cumsum(steps, axis=1) # integrate all positions by summing steps values along time axis
fig = go.Figure(data=go.Histogram(x=position[:, -1])) # positions at final time step
-fig.show()
+fig.show()
```
```python
@@ -134,7 +135,7 @@ fig.update_xaxes(title_text='$t$')
fig.update_yaxes(title_text='$l$', col=1)
fig.update_yaxes(title_text='$l^2$', col=2)
fig.update_layout(showlegend=False)
-fig.show()
+fig.show()
```
#### Advanced Tip
diff --git a/python/shapes.md b/python/shapes.md
index f584b9dc8..01f6f2fc4 100644
--- a/python/shapes.md
+++ b/python/shapes.md
@@ -462,6 +462,7 @@ fig.show()
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
# Generate data
x0 = np.random.normal(2, 0.45, 300)
@@ -706,4 +707,4 @@ fig.show()
```
### Reference
-See https://plot.ly/python/reference/#layout-shapes for more information and chart attribute options!
\ No newline at end of file
+See https://plot.ly/python/reference/#layout-shapes for more information and chart attribute options!
diff --git a/python/smoothing.md b/python/smoothing.md
index 995726b11..f29bbb035 100644
--- a/python/smoothing.md
+++ b/python/smoothing.md
@@ -65,6 +65,8 @@ import scipy
from scipy import signal
+np.random.seed(1)
+
x = np.linspace(0, 10, 100)
y = np.sin(x)
noise = 2 * np.random.random(len(x)) - 1 # uniformly distributed between -1 and 1
@@ -93,8 +95,8 @@ fig.add_trace(go.Scatter(
fig.add_trace(go.Scatter(
x=x,
- y=signal.savgol_filter(y,
- 53, # window size used for filtering
+ y=signal.savgol_filter(y,
+ 53, # window size used for filtering
3), # order of fitted polynomial
mode='markers',
marker=dict(
diff --git a/python/static-image-export.md b/python/static-image-export.md
index 049d73cdb..380594dbc 100644
--- a/python/static-image-export.md
+++ b/python/static-image-export.md
@@ -76,6 +76,7 @@ Now let's create a simple scatter plot with 100 random points of variying color
```python
import plotly.graph_objects as go
import numpy as np
+np.random.seed(1)
N = 100
x = np.random.rand(N)
diff --git a/python/table.md b/python/table.md
index 96d8ca667..44565c0e9 100644
--- a/python/table.md
+++ b/python/table.md
@@ -121,7 +121,7 @@ fig = go.Figure(data=[go.Table(
fig.show()
```
-#### Alternating Row Colors
+#### Alternating Row Colors
```python
import plotly.graph_objects as go
@@ -190,6 +190,7 @@ fig.show()
import plotly.graph_objects as go
from plotly.colors import n_colors
import numpy as np
+np.random.seed(1)
colors = n_colors('rgb(255, 200, 200)', 'rgb(200, 0, 0)', 9, colortype='rgb')
a = np.random.randint(low=0, high=9, size=10)
@@ -229,4 +230,4 @@ IFrame(src= "https://dash-simple-apps.plotly.host/dash-tableplot/code", width="1
```
#### Reference
-For more information on tables and table attributes see: https://plot.ly/python/reference/#table.
\ No newline at end of file
+For more information on tables and table attributes see: https://plot.ly/python/reference/#table.
diff --git a/python/violin.md b/python/violin.md
index ffa689533..e251539e2 100644
--- a/python/violin.md
+++ b/python/violin.md
@@ -244,6 +244,7 @@ A ridgeline plot ([previously known as Joy Plot](https://serialmentor.com/blog/2
import plotly.graph_objects as go
from plotly.colors import n_colors
import numpy as np
+np.random.seed(1)
# 12 sets of normal distributed random data, with increasing mean and standard deviation
data = (np.linspace(1, 2, 12)[:, np.newaxis] * np.random.randn(12, 200) +
diff --git a/python/webgl-vs-svg.md b/python/webgl-vs-svg.md
index a0bfec99f..dcc4e5577 100644
--- a/python/webgl-vs-svg.md
+++ b/python/webgl-vs-svg.md
@@ -51,6 +51,7 @@ import plotly.express as px
import pandas as pd
import numpy as np
+np.random.seed(1)
N = 100000