Skip to content

Commit d3bb2f0

Browse files
committed
wip: initial commit
0 parents  commit d3bb2f0

File tree

9 files changed

+202
-0
lines changed

9 files changed

+202
-0
lines changed

.github/workflows/deploy.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This file was created automatically with `myst init --gh-pages` 🪄 💚
2+
# Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**.
3+
4+
name: MyST GitHub Pages Deploy
5+
on:
6+
push:
7+
# Runs on pushes targeting the default branch
8+
branches: [main]
9+
env:
10+
# `BASE_URL` determines the website is served from, including CSS & JS assets
11+
# You may need to change this to `BASE_URL: ''`
12+
BASE_URL: /${{ github.event.repository.name }}
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
20+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
21+
concurrency:
22+
group: "pages"
23+
cancel-in-progress: false
24+
jobs:
25+
deploy:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Setup Pages
33+
uses: actions/configure-pages@v3
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: 18.x
37+
- uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.12'
40+
cache: 'pip' # caching pip dependencies
41+
- name: Install Python dependencies
42+
run: pip install -r requirements.txt
43+
- name: Install MyST Markdown
44+
run: npm install -g mystmd
45+
- name: Build HTML Assets
46+
run: myst build --html --execute
47+
- name: Upload artifact
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: "./_build/html"
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# MyST build outputs
2+
_build

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 MyST Examples
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# plots
2+
3+
An example of deploying a MyST site containing executable notebooks that generate plots.
4+
The demonstration plots are taken from the upstream library documentation.

bokeh.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
kernelspec:
3+
name: python3
4+
display_name: Python 3
5+
---
6+
7+
# Bokeh
8+
9+
```{code-cell} python3
10+
import numpy as np
11+
from scipy.integrate import odeint
12+
13+
from bokeh.plotting import figure, show
14+
from bokeh.io import output_notebook
15+
16+
output_notebook()
17+
```
18+
19+
```{code-cell} python3
20+
:name: fig-bokeh
21+
22+
sigma = 10
23+
rho = 28
24+
beta = 8.0/3
25+
theta = 3 * np.pi / 4
26+
27+
def lorenz(xyz, t):
28+
x, y, z = xyz
29+
x_dot = sigma * (y - x)
30+
y_dot = x * rho - x * z - y
31+
z_dot = x * y - beta* z
32+
return [x_dot, y_dot, z_dot]
33+
34+
initial = (-10, -7, 35)
35+
t = np.arange(0, 100, 0.006)
36+
37+
solution = odeint(lorenz, initial, t)
38+
39+
x = solution[:, 0]
40+
y = solution[:, 1]
41+
z = solution[:, 2]
42+
xprime = np.cos(theta) * x - np.sin(theta) * y
43+
44+
colors = ["#C6DBEF", "#9ECAE1", "#6BAED6", "#4292C6", "#2171B5", "#08519C", "#08306B"]
45+
46+
p = figure(title="Lorenz attractor example", background_fill_color="#fafafa")
47+
48+
p.multi_line(np.array_split(xprime, 7), np.array_split(z, 7),
49+
line_color=colors, line_alpha=0.8, line_width=1.5)
50+
51+
show(p)
52+
```

index.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Plots
2+
3+
There are many plots, such as [](#fig-plotly-output) and [](#fig-bokeh-output). See them below!
4+
5+
:::{embed} #fig-plotly
6+
:remove-input: true
7+
8+
A plotly figure.
9+
:::
10+
11+
![](#fig-bokeh)

myst.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See docs at: https://mystmd.org/guide/frontmatter
2+
version: 1
3+
project:
4+
id: ee007168-b9a5-4dba-8823-1639a4aeb956
5+
title: Hello Plots
6+
references:
7+
guide: https://mystmd.org/guide
8+
toc:
9+
- file: index.md
10+
- file: bokeh.md
11+
- file: plotly.md
12+
site:
13+
template: book-theme
14+
options:
15+
logo_text: Plots

plotly.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
kernelspec:
3+
name: python3
4+
display_name: Python 3
5+
---
6+
7+
# Plotly
8+
9+
```{code-cell} python3
10+
import plotly.graph_objects as go
11+
import numpy as np
12+
13+
np.random.seed(1)
14+
```
15+
16+
```{code-cell} python3
17+
#| label: fig-plotly
18+
19+
# Number of data points
20+
N = 10000
21+
22+
# Generate random data
23+
x = np.random.randn(N)
24+
y = np.random.randn(N).astype('float32')
25+
z = np.random.randint(size=N, low=0, high=256, dtype='uint8')
26+
c = np.random.randint(size=N, low=-10, high=10, dtype='int8')
27+
28+
fig = go.Figure(data=[go.Scatter3d(
29+
x=x,
30+
y=y,
31+
z=z,
32+
marker=dict(color=c),
33+
mode='markers',
34+
opacity=0.2
35+
)])
36+
37+
fig.show()
38+
```

requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
scipy
2+
numpy
3+
plotly
4+
bokeh
5+
jupyter-server
6+
ipykernel

0 commit comments

Comments
 (0)