Skip to content

Commit e8e982e

Browse files
author
Daniel Ruprecht
committed
all_residuals plots now in correct size and beautified pdf
1 parent fb9cada commit e8e982e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

examples/fault_tolerance/postproc_hard_faults_detail.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
axis_font = {'fontname':'Arial', 'size':'8', 'family':'serif'}
77
fs = 8
88

9-
# setup = 'HEAT'
9+
#setup = 'HEAT'
1010
setup = 'ADVECTION'
1111

1212
list = [(setup+'_steps_vs_iteration_hf_NOFAULT.npz','NOFAULT','no fault','k','^'),
@@ -79,11 +79,14 @@
7979
plt.savefig(fname, bbox_inches='tight')
8080
os.system('pdfcrop '+fname+' '+fname)
8181

82-
83-
fig, ax = plt.subplots(figsize=(15,10))
82+
#
83+
#
84+
#
85+
rcParams['figure.figsize'] = 6.0, 3.0
86+
fig, ax = plt.subplots()
8487
maxiter = 0
8588
lw = 2
86-
ms = 10
89+
ms = 8
8790

8891

8992
for file,strategy,label,color,marker in list:
@@ -105,7 +108,7 @@
105108

106109
xvals = range(1,maxiter+1)
107110
plt.plot(xvals,[-9 for i in range(maxiter)],'k--')
108-
plt.annotate('tolerance',xy=(1,-9.4),fontsize=24)
111+
plt.annotate('tolerance',xy=(1,-9.4),fontsize=fs)
109112

110113
left = 6.15
111114
bottom = -12
@@ -115,25 +118,29 @@
115118
top = bottom + height
116119
rect = plt.Rectangle(xy=(left,bottom),width=width,height=height,color='lightgrey')
117120
plt.text(0.5*(left+right),0.5*(bottom+top),'node failure',horizontalalignment='center',
118-
verticalalignment='center',rotation=90, color='k',fontsize=24)
121+
verticalalignment='center',rotation=90, color='k',fontsize=fs)
119122
fig.gca().add_artist(rect)
120123

121124
plt.xlim(1-0.25,maxiter+0.25)
122125
plt.ylim(minres-0.25,maxres+0.25)
123126

124-
plt.xlabel('iteration')
125-
plt.ylabel('log10(residual)')
127+
plt.xlabel('iteration', **axis_font)
128+
plt.ylabel('log10(residual)', **axis_font)
129+
ax.xaxis.labelpad = 0
130+
ax.yaxis.labelpad = 0
131+
plt.tick_params(axis='both', which='major', labelsize=fs)
126132

127-
plt.legend(numpoints=1)
133+
plt.legend(numpoints=1, fontsize=fs)
128134

129135
plt.xticks(range(1,maxiter+1))
130136
plt.yticks(range(minres,maxres+1))
131137

132-
ax.tick_params(pad=8)
138+
ax.tick_params(pad=2)
133139

134140
plt.tight_layout()
135141

136-
fname = setup+'_residuals_allstrategies.png'
137-
plt.savefig(fname, rasterized=True, transparent=True, bbox_inches='tight')
142+
fname = setup+'_residuals_allstrategies.pdf'
143+
plt.savefig(fname, bbox_inches='tight')
144+
os.system('pdfcrop '+fname+' '+fname)
138145

139146
# plt.show()

0 commit comments

Comments
 (0)