Skip to content

Commit bea2079

Browse files
authored
Merge pull request #90 from SWIFTSIM/no-plots
Added an option to not save any figures in the autoplotter.
2 parents 481cd65 + c0c1225 commit bea2079

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

velociraptor/autoplotter/objects.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,11 @@ def _make_plot_cumulative_histogram(
982982
return fig, ax
983983

984984
def make_plot(
985-
self, catalogue: VelociraptorCatalogue, directory: str, file_extension: str
985+
self,
986+
catalogue: VelociraptorCatalogue,
987+
directory: str,
988+
file_extension: str,
989+
no_plot: bool = False,
986990
):
987991
"""
988992
Federates out data parsing to individual functions based on the
@@ -1042,7 +1046,8 @@ def make_plot(
10421046
if self.y_label_override is not None:
10431047
self.y_label = self.y_label_override
10441048

1045-
fig.savefig(f"{directory}/{self.filename}.{file_extension}")
1049+
if not no_plot:
1050+
fig.savefig(f"{directory}/{self.filename}.{file_extension}")
10461051

10471052
# Delete the figure to cut down on memory consumption.
10481053
close(fig)
@@ -1161,7 +1166,11 @@ def link_catalogue(
11611166
return
11621167

11631168
def create_plots(
1164-
self, directory: str, file_extension: str = "pdf", debug: bool = False
1169+
self,
1170+
directory: str,
1171+
file_extension: str = "pdf",
1172+
debug: bool = False,
1173+
no_plots: bool = False,
11651174
):
11661175
"""
11671176
Creates and saves the plots in a directory.
@@ -1182,6 +1191,7 @@ def create_plots(
11821191
catalogue=self.catalogue,
11831192
directory=directory,
11841193
file_extension=file_extension,
1194+
no_plot=no_plots,
11851195
)
11861196
self.created_successfully.append(True)
11871197
except (AttributeError, ValueError) as e:

0 commit comments

Comments
 (0)