Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import matplotlib.pyplot as plt
import numpy as np
fig,ax = plt.subplots()
ax.axline((0, 0), (.1, .1), linewidth=2, color='C2')
ax.axline((0, 1), (1,0), linewidth=2, color='C4')
ax.axline((0.35, 0.5), (0.75, 0.5), linewidth=2, color='C6')
ax.set_xlim(0,1)
ax.set_ylim(0,1)
plt.savefig("axlines.png",dpi=133)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
%matplotlib widget
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from ipywidgets import interactive,IntSlider,VBox
from IPython.display import display
# Make data
u = np.linspace(0, 2 * np.pi, 100)
v = np.linspace(0, np.pi, 100)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import matplotlib.pyplot as plt
import numpy as np
u = np.linspace(0.001, 2 * np.pi, 100)
x = np.cos(u)+.3*np.random.rand(len(u))-.15
y = np.sin(u)+.3*np.random.rand(len(u))-.15
fig, ax = plt.subplots(figsize=(6,6),subplot_kw={'aspect': 'equal'})
ax.plot(x,y,'C6o')
ax.set_xlim(-1.2, 1.2)
ax.set_ylim(-1.2, 1.2)
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
from IPython.display import HTML
u = np.linspace(0.001, 2 * np.pi, 100)
x = 10*np.cos(u)
y = 10*np.sin(u)
x_ = np.linspace(-13,13,100)
fig, ax = plt.subplots(figsize=(6,6),subplot_kw={'aspect': 'equal'})
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Ellipse
import matplotlib.animation as animation
from IPython.display import HTML
num = 250
ells = [Ellipse(xy=np.random.rand(2) * 10,
width=np.random.rand(), height=np.random.rand(),
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.