Skip to content

Commit df2348b

Browse files
committed
another fix
1 parent b71b26b commit df2348b

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed
Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import os
2-
import numpy
3-
from amuse.lab import *
2+
import matplotlib.pyplot as plt
43

5-
from prepare_figure import single_frame
6-
from distinct_colours import get_distinct
7-
from matplotlib import pyplot
84

95
def read_triple_data(filename):
10-
t = []
11-
ain = []
6+
t = []
7+
ain = []
128
aout = []
139
ein = []
1410
eout = []
@@ -25,33 +21,35 @@ def read_triple_data(filename):
2521
e0out = float(l[18])
2622
if ti >= 4:
2723
t.append(float(l[3]))
28-
ain.append(float(l[10])/a0in)
29-
ein.append(float(l[12])/e0in)
30-
aout.append(float(l[16])/a0out)
31-
eout.append(float(l[18])/e0out)
24+
ain.append(float(l[10]) / a0in)
25+
ein.append(float(l[12]) / e0in)
26+
aout.append(float(l[16]) / a0out)
27+
eout.append(float(l[18]) / e0out)
3228
return t, ain, ein, aout, eout
3329

30+
3431
try:
35-
amusedir = os.environ['AMUSE_DIR']
36-
dir = amusedir+'/examples/textbook/'
32+
amusedir = os.environ["AMUSE_DIR"]
33+
path = amusedir + "/examples/textbook/"
3734
except:
38-
print('Environment variable AMUSE_DIR not set')
39-
dir = './'
40-
filename = dir+'evolve_triple_with_wind.data'
35+
print("Environment variable AMUSE_DIR not set")
36+
path = "./"
37+
filename = path + "evolve_triple_with_wind.data"
4138

4239
t, ain, ein, aout, eout = read_triple_data(filename)
4340

4441
x_label = "$a/a_{0}$"
4542
y_label = "$e/e_{0}$"
46-
fig = single_frame(x_label, y_label, logx=False, logy=False,
47-
xsize=10, ysize=8)
48-
color = get_distinct(2)
49-
50-
pyplot.plot(ain, ein, c=color[0], label= 'inner')
51-
pyplot.plot(aout, eout, c=color[1], label= 'outer')
52-
pyplot.legend(loc='best', ncol=1, shadow=False, fontsize=20)
53-
54-
save_file = 'evolve_triple_with_wind.png'
55-
pyplot.savefig(save_file)
56-
print('\nSaved figure in file', save_file,'\n')
57-
pyplot.show()
43+
fig = plt.figure()
44+
ax = fig.add_subplot(1, 1, 1)
45+
ax.set_xlabel(x_label)
46+
ax.set_ylabel(y_label)
47+
48+
ax.plot(ain, ein, label="inner")
49+
ax.plot(aout, eout, label="outer")
50+
ax.legend(loc="best", ncol=1, shadow=False, fontsize=20)
51+
52+
save_file = "evolve_triple_with_wind.png"
53+
plt.savefig(save_file)
54+
print("\nSaved figure in file", save_file, "\n")
55+
plt.show()

0 commit comments

Comments
 (0)