Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Feb 19, 2024
1 parent 34a3f01 commit d44a647
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
14 changes: 11 additions & 3 deletions docs/qpyodide-code-cell-demo.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ df.Age

## Graphing

:::{.callout-important}
Graphing is not yet available.
:::
We provide support for generating graphs through the interactive HTML5 backend, e.g. [`module://matplotlib_pyodide.html5_canvas_backend](https://github.com/pyodide/matplotlib-pyodide). At the end of each graph call, you must include a `plt.show()` call for the graph to render.

```{pyodide-python}
import matplotlib.pyplot as plt
x = [1, 5, 3, -2]
y = [-5, 8, 9, 4]
plt.plot(x, y)
plt.show()
```
24 changes: 24 additions & 0 deletions tests/qpyodide-test-graphic-output.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "Test: Graphics Output"
format: html
filters:
- pyodide
---

This webpage tests the interactive and output contexts for showing a graph.

:::callout-important
A call to `matplotlib.pyplot.show()` is required for displaying the graphic.
:::

## Interactive

```{pyodide-python}
import matplotlib.pyplot as plt
x = [1, 5, 3, -2]
y = [-5, 8, 9, 4]
plt.plot(x, y)
plt.show()
```
9 changes: 0 additions & 9 deletions tests/qpyodide-test-internal-cell.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ Test page for verifying cell context options set explicitly with `context`.

## Interactive

### Static
```{pyodide-python}
#| context: interactive
1 + 1
```

### Autorun

```{pyodide-python}
#| context: interactive
#| autorun: true
1 + 1
```

## Setup

Hidden cell that sets `x` and `y` vector values.
Expand Down

0 comments on commit d44a647

Please sign in to comment.