Skip to content
Snippets Groups Projects
Commit 16d9d896 authored by 数学の武士's avatar 数学の武士
Browse files

Add multiple plot, need check

parent 590097fb
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......@@ -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 )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment