Exemplo n.º 1
0
import matplotlib.pyplot as plt
import numpy as np
import pyvie as pv

movie = pv.Movie("SkydiverExample",
                 framerate=10,
                 dpi=400,
                 file_type='.png',
                 movie_type='.avi')
x0 = 0
y0 = 1000
x = [x0]
y = [y0]
vix = 10
viy = 0
vx = [vix]
vy = [viy]
axi = 0
ayi = -9.81
ax = [axi]
ay = [ayi]
start = 0
end = 15
steps = 20
time = np.linspace(start, end, steps)
for t in time[1:]:

    f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(10, 10))
    ax1.set_title('Skydiver', fontsize=22)
    ax1.scatter(x[-1], y[-1])
    ax1.set_ylim(0, 1050)
Exemplo n.º 2
0
import pyvie as pv
import numpy as np
import matplotlib.pyplot as plt

movie = pv.Movie('UpdatingPlotExample',
                 framerate=10,
                 dpi=400,
                 file_type='.png',
                 movie_type='.avi')
plt.figure(figsize=(10, 10))
x_data = []
y_data = []
lower_line = []
upper_line = []
for t in range(101):
    plt.clf()
    y_data.append(t * np.random.choice([1, 2, 3]))
    x_data.append(t)
    lower_line.append(t)
    upper_line.append(3 * t)
    plt.plot(x_data, lower_line, linewidth=2, c='r')
    plt.plot(x_data, upper_line, linewidth=2, c='g')
    plt.plot(x_data, y_data, linewidth=2, c='black')
    plt.fill_between(x_data, lower_line, upper_line, alpha=.3, color='black')
    plt.xlim(0, 100)
    plt.ylim(0, 300)
    plt.title('Updating Plot', fontsize=22)
    plt.xticks(fontsize=15)
    plt.yticks(fontsize=15)
    plt.grid(alpha=.5)
    movie.gather()
Exemplo n.º 3
0
import pyvie as pv
import numpy as np
import matplotlib.pyplot as plt

movie = pv.Movie('SineWaveExample',
                 framerate=20,
                 dpi=400,
                 file_type='.png',
                 movie_type='.avi')
plt.figure(figsize=(10, 10))
for phi in np.linspace(0, 2 * np.pi, 300):
    plt.clf()
    x = np.linspace(0, 2 * np.pi, 100)
    y = np.sin(x + phi)
    plt.plot(x, y, linewidth=4)
    plt.xlim(0, 2 * np.pi)
    plt.grid(alpha=.5)
    plt.title('Sine Wave Example', fontsize=22)
    plt.xticks(fontsize=15)
    plt.yticks(fontsize=15)
    movie.gather()
movie.finalize()
Exemplo n.º 4
0
import pyvie as pv
import numpy as np
import matplotlib.pyplot as plt

movie = pv.Movie("ImshowExample",
                 framerate=5,
                 dpi=400,
                 file_type='.png',
                 movie_type='.avi')
plt.figure(figsize=(10, 10))
grid = np.zeros((10, 10))
for t in range(100):
    plt.clf()
    y = np.random.randint(0, grid.shape[0])
    x = np.random.randint(0, grid.shape[1])
    grid[y, x] += 1
    plt.imshow(grid)
    plt.title('2D Imshow', fontsize=22)
    plt.xticks(fontsize=15)
    plt.yticks(fontsize=15)
    movie.gather()
movie.finalize()
Exemplo n.º 5
0
import pyvie as pv
import numpy as np
import matplotlib.pyplot as plt

movie = pv.Movie("RandomImageExample",framerate=1,dpi=400,file_type='.png',movie_type = '.avi')

plt.imshow(np.zeros((10,10)))
movie.gather()
plt.clf()
plt.imshow(np.random.uniform(size=(10,10)))
movie.gather()
plt.clf()
plt.imshow(np.random.random(size=(10,10)))
movie.gather()
plt.clf()
plt.scatter([1,2,3,4],[5,6,7,8])
movie.gather()
plt.clf()
plt.plot(np.linspace(0,2*np.pi,100),np.sin(np.linspace(0,2*np.pi,100))*np.cos(np.linspace(0,2*np.pi,100)))
movie.gather()

movie.finalize()