21 if not os.path.exists(plt_dir_name):
22 os.makedirs(plt_dir_name)
27 matplotlib.rc(
'font', **font)
30 for var
in range(a_nvars):
32 fig = plt.figure(figsize=figsize)
34 ax.set( xlim=(np.min(a_x), np.max(a_x)),
35 ylim=(np.min(a_U[var::a_nvars]),
36 np.max(a_U[var::a_nvars]) ) )
37 ax.plot(a_x, a_U[var::a_nvars], lw=2)
38 ax.set_title(
'var {:}, t={:.3}'.format(var,a_time))
39 plt.grid(visible=
True, linestyle=
':', linewidth=1)
41 plt_fname = plt_dir_name+
'/'+a_fname
43 plt_fname = plt_dir_name+
'/var'+f
'{var:02d}'+
'_'+a_fname
44 print(
'Saving %s' % plt_fname)
45 plt.savefig(plt_fname)
48 print(
'Error in plotBinarySolution: unable to generate plot for var %d' % var)
49 print(
'Error in plotBinarySolution: nvars is %d' % a_nvars)
54 matplotlib.rc(
'font', **font)
60 y2d, x2d = np.meshgrid(y, x)
62 for var
in range(a_nvars):
64 fig = plt.figure(figsize=figsize)
66 ax.set( xlim=(np.min(x), np.max(x)),
67 ylim=(np.min(y), np.max(y)) )
68 sol2d = np.transpose(a_U.reshape(a_size[1],a_size[0],a_nvars))
69 plot = ax.pcolor(x2d, y2d, sol2d[var,:,:], cmap=colormap)
70 ax.set_title(
'var {:}, t={:.3}'.format(var,a_time))
71 fig.colorbar(plot, ax=ax)
73 plt_fname = plt_dir_name+
'/'+a_fname
75 plt_fname = plt_dir_name+
'/var'+f
'{var:02d}'+
'_'+a_fname
76 print(
'Saving %s' % plt_fname)
77 plt.savefig(plt_fname)
80 print(
'Error in plotBinarySolution: unable to generate plot for var %d' % var)
81 print(
'Error in plotBinarySolution: nvars is %d' % a_nvars)
85 print(
'plotSolution.py: No plotting implemented for a_ndims=%d', a_ndims)