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():
result_fn = "result.csv"
with open(result_fn, "w") as f:
check_call(["cargo", "run", "--release"], 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("lorenz63.png")
if __name__ == '__main__':
main()