@@ -144,7 +144,11 @@ def main():
144
144
# nightmare to work with
145
145
# Get y data
146
146
for name in x_data_files_names :
147
- file_path_to_get_data_fom = glob .glob (f'{ args ["results_folder" ]} /{ name } /{ plot_line ["ydata" ]["file" ]} ' )[0 ]
147
+ try :
148
+ file_path_to_get_data_fom = glob .glob (f'{ args ["results_folder" ]} /{ name } /{ plot_line ["ydata" ]["file" ]} ' )[0 ]
149
+ except :
150
+ atomError (f"Experiment { x_data_files_names } doesn't have data file { plot_line ['ydata' ]['file' ]} " )
151
+ exit ()
148
152
# Method with pandas, not working
149
153
# df = df.T
150
154
# df.drop(0)
@@ -206,6 +210,8 @@ def main():
206
210
markers = plot_options ['markers' ]
207
211
xscale = plot_options ['xscale' ]
208
212
yscale = plot_options ['yscale' ]
213
+ xlim = plot_options .get ('xlim' )
214
+ ylim = plot_options .get ('ylim' )
209
215
210
216
211
217
# Normalizing options to allow them to be defined as lists or individual str/int
@@ -237,7 +243,7 @@ def main():
237
243
238
244
x_values = plot_line ['x_values' ]
239
245
y_values = plot_line ['y_values' ]
240
- legend = plot_line [ 'legend' ] if plot_line [ 'legend' ] else None
246
+ legend = plot_line . get ( 'legend' )
241
247
242
248
# Plotting
243
249
plt .plot (x_values , y_values , color = colors [idx ], linestyle = linestyles [idx ], linewidth = linewidths [idx ],
@@ -250,6 +256,12 @@ def main():
250
256
plt .yscale (yscale ) # Set y-scale
251
257
if legend is not None :
252
258
plt .legend (prop = {'size' : 6 })
259
+
260
+ if xlim :
261
+ plt .xlim (xlim )
262
+
263
+ if ylim :
264
+ plt .ylim (ylim )
253
265
254
266
# Save figure in output folder
255
267
@@ -269,6 +281,8 @@ def main():
269
281
if args ["show_plots" ]:
270
282
plt .show ()
271
283
284
+ plt .close ()
285
+
272
286
# Getting back to cwd, to prevent confusion if this script is further modified
273
287
os .chdir (cwd )
274
288
0 commit comments