Update display to 3D plots
This commit is contained in:
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class DynamicUpdate():
|
||||
#We need to draw *and* flush
|
||||
self.fig.canvas.draw()
|
||||
self.fig.canvas.flush_events()
|
||||
if not step is None and step%50==0:
|
||||
if not step is None and step%10==0:
|
||||
self.fig.savefig("tmp/{0:05d}.png".format(step),bbox_inches="tight")
|
||||
|
||||
#Example
|
||||
|
||||
12
main.py
12
main.py
@@ -12,12 +12,12 @@ def main():
|
||||
|
||||
x1 = np.array([-1, 0, 0])
|
||||
x2 = np.array([1, 0, 0])
|
||||
x3 = np.array([100, 0, 0])
|
||||
x3 = np.array([100, 0, 20])
|
||||
q = np.array([x1, x2, x3])
|
||||
|
||||
v1 = np.array([0, -0.35, 0])
|
||||
v2 = np.array([0, 0.35, 0])
|
||||
v3 = np.array([0, 0, 0])
|
||||
v3 = np.array([0, 20., 0])
|
||||
v = np.array([v1, v2, v3])
|
||||
|
||||
bodylist = []
|
||||
@@ -26,14 +26,14 @@ def main():
|
||||
dyn_syst = System(bodylist)
|
||||
dyn_syst.COMShift()
|
||||
|
||||
duration, step = 50, 0.01
|
||||
E, L = frogleap(duration, step, dyn_syst, recover_param=True, display=True)
|
||||
fig1 = plt.figure()
|
||||
duration, step = 100, 0.01
|
||||
E, L = frogleap(duration, step, dyn_syst, recover_param=True)#, display=True)
|
||||
fig1 = plt.figure(figsize=(30,15))
|
||||
ax1 = fig1.add_subplot(111)
|
||||
ax1.plot(np.arange(E.shape[0])/duration, E, label=r"$E_m$")
|
||||
ax1.legend()
|
||||
fig1.savefig("plots/Em.png",bbox_inches="tight")
|
||||
fig2 = plt.figure()
|
||||
fig2 = plt.figure(figsize=(30,15))
|
||||
ax2 = fig2.add_subplot(111)
|
||||
ax2.plot(np.arange(L.shape[0])/duration, np.sum(L**2,axis=1), label=r"$L^2$")
|
||||
ax2.legend()
|
||||
|
||||
BIN
plots/Em.png
BIN
plots/Em.png
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 196 KiB |
BIN
plots/L2.png
BIN
plots/L2.png
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 456 KiB After Width: | Height: | Size: 1.1 MiB |
Reference in New Issue
Block a user