|
16 | 16 |
|
17 | 17 | if __name__ == "__main__": |
18 | 18 | mvals = [2, 3, 4] |
19 | | - kvals = np.arange(2,10) |
20 | | - lambda_fast = 15j |
21 | | - lambda_slow = 3j |
| 19 | + kvals = np.arange(1,10) |
| 20 | + lambda_fast = 10j |
| 21 | + slow_resolved = False |
| 22 | + if slow_resolved: |
| 23 | + lambda_slow = 1j |
| 24 | + else: |
| 25 | + lambda_slow = 4j |
22 | 26 | stabval = np.zeros((np.size(mvals), np.size(kvals))) |
23 | 27 |
|
24 | 28 | for i in range(0,np.size(mvals)): |
|
68 | 72 | rcParams['figure.figsize'] = 2.5, 2.5 |
69 | 73 | fig = plt.figure() |
70 | 74 | fs = 8 |
71 | | - plt.plot(kvals, stabval[0,:], 'o-', color='b', label=("M=%2i" % mvals[0])) |
72 | | - plt.plot(kvals, stabval[1,:], 's-', color='r', label=("M=%2i" % mvals[1])) |
73 | | - plt.plot(kvals, stabval[2,:], 'd-', color='g', label=("M=%2i" % mvals[2])) |
| 75 | + plt.plot(kvals, stabval[0,:], 'o-', color='b', label=("M=%2i" % mvals[0]), markersize=fs-2) |
| 76 | + plt.plot(kvals, stabval[1,:], 's-', color='r', label=("M=%2i" % mvals[1]), markersize=fs-2) |
| 77 | + plt.plot(kvals, stabval[2,:], 'd-', color='g', label=("M=%2i" % mvals[2]), markersize=fs-2) |
74 | 78 | plt.plot(kvals, 1.0+0.0*kvals, '--', color='k') |
75 | 79 | plt.xlabel('Number of iterations K', fontsize=fs) |
76 | 80 | plt.ylabel(r'Modulus of stability function $\left| R \right|$', fontsize=fs) |
77 | 81 | plt.ylim([0.0, 1.2]) |
78 | | - plt.legend(loc='lower left', fontsize=fs, prop={'size':fs}) |
| 82 | + if slow_resolved: |
| 83 | + plt.legend(loc='upper right', fontsize=fs, prop={'size':fs}) |
| 84 | + else: |
| 85 | + plt.legend(loc='lower left', fontsize=fs, prop={'size':fs}) |
| 86 | + |
79 | 87 | plt.gca().get_xaxis().get_major_formatter().labelOnlyBase = False |
80 | 88 | plt.gca().get_xaxis().set_major_formatter(ScalarFormatter()) |
81 | | - plt.show() |
82 | | - |
83 | | -# filename = 'stablimit-M'+str(mvals[0])+'.pdf' |
84 | | -# fig.savefig(filename, bbox_inches='tight') |
85 | | -# call(["pdfcrop", filename, filename]) |
| 89 | + #plt.show() |
| 90 | + if slow_resolved: |
| 91 | + filename = 'stab_vs_k_resolved.pdf' |
| 92 | + else: |
| 93 | + filename = 'stab_vs_k_unresolved.pdf' |
| 94 | + |
| 95 | + fig.savefig(filename, bbox_inches='tight') |
| 96 | + call(["pdfcrop", filename, filename]) |
0 commit comments