diff --git a/plotter/Plotter.py b/plotter/Plotter.py index 0620550482b05cd0670f30a04db60e6dace2776d..f1712975c26def90bacaf3d50469b075b00acfe6 100755 --- a/plotter/Plotter.py +++ b/plotter/Plotter.py @@ -88,7 +88,7 @@ class Plotter: if args.func != self.dump: - if args.func == self.plot or args.func == self.ani_plot: + if args.func == self.plot or args.func == self.ani_plot or args.func == self.multiple_plot: self.ndim = 1 elif args.func == self.plot_contour or args.func == self.ani_plot_contour: self.ndim = 2 @@ -113,11 +113,31 @@ class Plotter: plt.legend(self.var) plt.xlabel(x_name, fontsize=10, fontweight='bold') + plt.xlabel(y_name, fontsize=10, fontweight='bold') if self.if_manual_plot: plt.show() else: plt.close(fig) if self.if_save_result: fig.savefig(self.out + self.oname[0]) + def __multiple_plot(self): + os.system("mkdir -p " + self.out) + x_name = self.file_column_names[0] + + fig = plt.figure() + + for data in self.file_data: + for y_name in self.var: + plt.plot(data.data[x_name], data.data[y_name], linewidth=4) + plt.legend(self.filename) + plt.xlabel(x_name, fontsize=10, fontweight='bold') + plt.ylabel(y_name, fontsize=10, fontweight='bold') + + if self.if_manual_plot: plt.show() + else: plt.close(fig) + if self.if_save_result: fig.savefig(self.out + self.oname[0]) + + + def __get_min_max_ax(self): min_max_var_vals = {var : [] for var in self.var} @@ -432,4 +452,8 @@ class Plotter: def get_data(self): return_data = [copy.deepcopy(data.data) for data in self.file_data] - return return_data \ No newline at end of file + return return_data + + def multiple_plot(self): + self.__get_min_max_ax() + self.__multiple_plot() \ No newline at end of file diff --git a/plotter/__init__.py b/plotter/__init__.py index 6f6cd904dbe1fcb47fa7a0ae93806d1634f5b0f8..4c896fe2aabf0f635ca1bd9ea0ce20792a179edc 100755 --- a/plotter/__init__.py +++ b/plotter/__init__.py @@ -8,4 +8,4 @@ from .main import ani_plot_contour from .main import avg_plot from .main import plot_diff from .main import get_data - +from .main import multiple_plot diff --git a/plotter/main.py b/plotter/main.py index 2d165cbf5d92460e2179e5ffe514f599de78622e..7c6eb6343eaaa888fda515923a0feb34f2802162 100755 --- a/plotter/main.py +++ b/plotter/main.py @@ -20,6 +20,12 @@ def plot(filename, out = './', oname = 'fig.png', var=[None], mval=[None], min_y Plot.set(args, if_manual_plot=manual_plot, if_save_result=save_result) Plot.plot() +def multiple_plot(filename, out = './', oname = 'fig.png', var=[None], mval=[None], min_y = None, max_y = None): + Plot = Plotter() + args = Args(filename, Plot.multiple_plot, var=var, mval=mval, oname=oname, out=out) + Plot.set(args, if_manual_plot=manual_plot, if_save_result=save_result) + Plot.multiple_plot() + def ani_plot(filename, out = './', oname = 'fig.gif', var=[None], mval=[None], min_y = None, max_y = None): pp = str(PurePath(filename).parent) + '/' name = str(PurePath(filename).name )