Path: blob/main/dev-docs/feature-format-matrix/qmd-files/layout/fig-align/code-python-caption.qmd
6442 views
---
format:
html:
quality: 1
pdf:
quality: 0
typst:
quality: 0
dashboard:
quality: -1
docx:
quality: 0
pptx:
quality: -1
keep-typ: true
_quarto:
tests:
typst:
ensureTypstFileRegexMatches:
- []
- []
# testable but not working yet
# -
# - "#align\\(right\\)\\[(\r\n?|\n)#box"
# -
# - "#block\\[(\r\n?|\n)#align\\(right\\)\\["
---
---
```{python}
#| fig-width: 3
#| fig-align: right
#| fig-cap: a figure
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig, ax = plt.subplots()
fig.set_figwidth(2)
ax.plot(t, s)
ax.set(xlabel='time (s)', ylabel='voltage (mV)')
ax.grid()
plt.show()
```