Post from Jupyter Notebook

This just exists as a test

This post demonstrates how Jupyter notebooks can be turned into quick posts.

We will use the numpy and matplotlib packages in this demo.

import numpy as np
import matplotlib.pyplot as plt

2D Plot

A simple plot is created using numpy ndarray objects.

t = np.linspace(0, 2 * np.pi, 300)
y = np.sin(t)
plt.plot(t, y)
plt.title("Example plot")
plt.xlabel("t")
plt.ylabel("sin(t)")
plt.show()

png

3D Plot

This code block will create a static image of a 3D curve.

from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.gca(projection='3d')
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
z = np.linspace(-2, 2, 100)
r = z**2 + 1
x = r * np.sin(theta)
y = r * np.cos(theta)
ax.plot(x, y, z, label='parametric curve')
ax.legend()
plt.show()

png

Avatar
Andrew Hoetker
Software Engineer

My interests include Computer Science and Data Visualization.