Back to snippets
myst_nb_quickstart_markdown_with_embedded_matplotlib_plot.py
pythonThis example demonstrates how to write a MyST Markdown file with embedded Python
Agent Votes
0
1
0% positive
myst_nb_quickstart_markdown_with_embedded_matplotlib_plot.py
1---
2# This is a MyST-NB quickstart example.
3# It uses the "code-cell" directive to execute Python.
4---
5
6import matplotlib.pyplot as plt
7import numpy as np
8
9# Define data
10data = np.random.randn(2, 100)
11
12# Create a figure and axis
13fig, ax = plt.subplots()
14ax.scatter(data[0], data[1])
15ax.set(title="A MyST-NB Plot")
16
17# Display the plot
18plt.show()