r-wasm / quarto-live

WebAssembly powered code blocks and exercises for both the R and Python languages in Quarto documents
https://r-wasm.github.io/quarto-live/
MIT License
128 stars 9 forks source link

fig-height/fig-width with Pyodide might not be respected in RevealJS #71

Open coatless opened 1 week ago

coatless commented 1 week ago

Not sure that fig-height/fig-width cell options are being applied in a pyodide cell. If I'm remembering, the underlying matplotlib integration is using a custom shim?

---
title: "graph resize"
format: live-revealjs
---

## Let's graph

```{pyodide}
#| fig-height: 3
#| fig-width: 3
#| echo: false
#| autorun: true
import numpy as np
import matplotlib.pyplot as plt

a = 1
b = 0

x = np.linspace(0, 10, 100)
y = a * x + b

plt.figure(figsize=(8, 4))
plt.plot(x, y)
plt.grid(True)
plt.title(f'Linear Function: y = {a}x + {b}')
plt.show()