-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfigure.py
More file actions
executable file
·29 lines (23 loc) · 725 Bytes
/
figure.py
File metadata and controls
executable file
·29 lines (23 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
from subprocess import check_call
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def main(name):
result_fn = name + ".csv"
with open(result_fn, "w") as f:
check_call(["cargo", "run", "--release", "--bin", name], stdout=f)
data = pd.read_csv(result_fn).set_index("time")[1:]
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.plot(xs=data["x"], ys=data["y"], zs=data["z"])
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")
plt.savefig(name + ".png")
if __name__ == '__main__':
main("lorenz63")
main("roessler")