Skip to content
Snippets Groups Projects
Commit 2914a07b authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Improved figure identifiers.

parent 53c9e96e
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ class TroubledCellDetector(object):
print('maximum error =', max_error)
def _plot_shock_tube(self, troubled_cell_history, time_history):
plt.figure(6)
plt.figure('shock_tube')
for pos in range(len(time_history)):
current_cells = troubled_cell_history[pos]
for cell in current_cells:
......@@ -106,7 +106,7 @@ class TroubledCellDetector(object):
@staticmethod
def _plot_solution_and_approx(grid, exact, approx, color_exact, color_approx):
print(color_exact, color_approx)
plt.figure(1)
plt.figure('exact_and_approx')
plt.plot(grid[0], exact[0], color_exact)
plt.plot(grid[0], approx[0], color_approx)
plt.xlabel('x')
......@@ -115,7 +115,7 @@ class TroubledCellDetector(object):
@staticmethod
def _plot_semilog_error(grid, pointwise_error):
plt.figure(2)
plt.figure('semilog_error')
plt.semilogy(grid[0], pointwise_error[0])
plt.xlabel('x')
plt.ylabel('|u(x,t)-uh(x,t)|')
......@@ -123,7 +123,7 @@ class TroubledCellDetector(object):
@staticmethod
def _plot_error(grid, exact, approx):
plt.figure(3)
plt.figure('error')
plt.plot(grid[0], exact[0]-approx[0])
plt.xlabel('X')
plt.ylabel('u(x,t)-uh(x,t)')
......@@ -183,16 +183,16 @@ class TroubledCellDetector(object):
os.makedirs(self._plot_dir + '/shock_tube')
# Save plots
plt.figure(1)
plt.figure('exact_and_approx')
plt.savefig(self._plot_dir + '/exact_and_approx/' + name + '.pdf')
plt.figure(2)
plt.figure('semilog_error')
plt.savefig(self._plot_dir + '/semilog_error/' + name + '.pdf')
plt.figure(3)
plt.figure('error')
plt.savefig(self._plot_dir + '/error/' + name + '.pdf')
plt.figure(6)
plt.figure('shock_tube')
plt.savefig(self._plot_dir + '/shock_tube/' + name + '.pdf')
......@@ -295,7 +295,7 @@ class WaveletDetector(TroubledCellDetector):
for degree in range(self._polynomial_degree + 1)], axis=0)
projected_wavelet_coeffs = np.sum(wavelet_projection, axis=0)
plt.figure(4)
plt.figure('coeff_details')
plt.plot(fine_mesh, projected_fine - projected_coarse, 'm-.')
plt.plot(fine_mesh, projected_wavelet_coeffs, 'y')
plt.legend(['Fine-Coarse', 'Wavelet Coeff'])
......@@ -342,7 +342,7 @@ class WaveletDetector(TroubledCellDetector):
if not os.path.exists(self._plot_dir + '/coeff_details'):
os.makedirs(self._plot_dir + '/coeff_details')
plt.figure(4)
plt.figure('coeff_details')
plt.savefig(self._plot_dir + '/coeff_details/' + name + '.pdf')
def _plot_coarse_mesh(self, projection):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment