|
1 | 1 | import numpy as np |
2 | 2 | from matplotlib import pyplot as plt |
3 | 3 | from pylab import rcParams |
| 4 | +from matplotlib.ticker import ScalarFormatter |
4 | 5 |
|
5 | 6 | fs = 8 |
6 | 7 | order = np.array([]) |
|
39 | 40 | rcParams['figure.figsize'] = 2.5, 2.5 |
40 | 41 | fig = plt.figure() |
41 | 42 | for ii in range(0,3): |
42 | | - plt.loglog(nsteps_plot[ii,:], error_plot[ii,:], shape[ii], markersize=fs, color=color[ii], label='p='+str(int(order_plot[ii]))) |
43 | 43 | plt.loglog(nsteps_plot[ii,:], convline[ii,:], '-', color=color[ii]) |
| 44 | + plt.loglog(nsteps_plot[ii,:], error_plot[ii,:], shape[ii], markersize=fs, color=color[ii], label='p='+str(int(order_plot[ii]))) |
| 45 | + |
44 | 46 |
|
45 | 47 | plt.legend(loc='upper right', fontsize=fs, prop={'size':fs}) |
46 | | -plt.xlabel(r'Number of time step $N_t$', fontsize=fs) |
| 48 | +plt.xlabel('Number of time steps', fontsize=fs) |
47 | 49 | plt.ylabel('Relative error', fontsize=fs, labelpad=2) |
48 | 50 | plt.xlim([0.9*np.min(nsteps_plot), 1.1*np.max(nsteps_plot)]) |
49 | 51 | plt.ylim([1e-7, 1e1]) |
50 | | -plt.yticks(fontsize=fs) |
51 | | -plt.xticks(fontsize=fs) |
| 52 | +plt.yticks([1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0, 1e1],fontsize=fs) |
| 53 | +plt.xticks([25, 50, 100], fontsize=fs) |
| 54 | +plt.gca().get_xaxis().get_major_formatter().labelOnlyBase = False |
| 55 | +plt.gca().get_xaxis().set_major_formatter(ScalarFormatter()) |
52 | 56 | plt.show() |
53 | 57 | fig.savefig('sdc_fwsw_convergence.pdf',bbox_inches='tight') |
54 | 58 |
|
0 commit comments