Simple matplotlib execution
Lets check the contents of this file!
output
# This is a matplotlib example
Lets check the contents of this file!
```{python}
with open("matplotlib_example.qmd", "r") as f:
for l in f:
print(str(l).strip())
```
```{python}
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery')
# Make data
n = 20
x = np.sin(np.linspace(0, 2*np.pi, n))
y = np.cos(np.linspace(0, 2*np.pi, n))
z = np.linspace(0, 1, n)
# Plot
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
ax.stem(x, y, z)
ax.set(xticklabels=[],
yticklabels=[],
zticklabels=[])
plt.show()
```
import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery')
# Make data
n = 20
x = np.sin(np.linspace(0, 2*np.pi, n))
y = np.cos(np.linspace(0, 2*np.pi, n))
z = np.linspace(0, 1, n)
# Plot
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
ax.stem(x, y, z)
ax.set(xticklabels=[],
yticklabels=[],
zticklabels=[])
plt.show()