Skip to content

set random seed for less build churn #113

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

Merged
merged 1 commit into from
Aug 26, 2019
Merged
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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions python/2D-Histogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions python/2d-histogram-contour.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions python/3d-axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions python/annotated_heatmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 + '<br>' + 'Atomic Mass: ' + str(j)
hover.append([i + '<br>' + 'Atomic Mass: ' + str(j)
for i, j in zip(element[x], atomic_mass[x])])

# Invert Matrices
Expand All @@ -208,4 +209,4 @@ For more info on Plotly heatmaps, see: https://plot.ly/python/reference/#heatmap

```python
help(ff.create_annotated_heatmap)
```
```
1 change: 1 addition & 0 deletions python/box-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions python/click-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion python/compare-webgl-svg.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -103,4 +104,4 @@ fig.show()

For more information see <br>
`Scattergl()` : https://plot.ly/python/reference/#scattergl <br>
`Scatter()` : https://plot.ly/python/reference/#scatter
`Scatter()` : https://plot.ly/python/reference/#scatter
1 change: 1 addition & 0 deletions python/custom-buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion python/dendrogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -183,4 +184,4 @@ fig.show()

```python
help(ff.create_dendrogram)
```
```
1 change: 1 addition & 0 deletions python/distplot.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions python/dropdowns.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions python/heatmaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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!
See https://plot.ly/python/reference/#heatmap for more information and chart attribute options!
1 change: 1 addition & 0 deletions python/histograms.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions python/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions python/line-and-scatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions python/line-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion python/marker-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,))
Expand Down Expand Up @@ -313,4 +314,4 @@ fig.show()
```

### Reference
See https://plot.ly/python/reference/ for more information and chart attribute options!
See https://plot.ly/python/reference/ for more information and chart attribute options!
3 changes: 2 additions & 1 deletion python/orca-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
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.
5 changes: 3 additions & 2 deletions python/random-walk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion python/shapes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -706,4 +707,4 @@ fig.show()
```

### Reference
See https://plot.ly/python/reference/#layout-shapes for more information and chart attribute options!
See https://plot.ly/python/reference/#layout-shapes for more information and chart attribute options!
6 changes: 4 additions & 2 deletions python/smoothing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions python/static-image-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions python/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
For more information on tables and table attributes see: https://plot.ly/python/reference/#table.
1 change: 1 addition & 0 deletions python/violin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) +
Expand Down
1 change: 1 addition & 0 deletions python/webgl-vs-svg.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import plotly.express as px

import pandas as pd
import numpy as np
np.random.seed(1)

N = 100000

Expand Down