@@ -14,26 +14,9 @@ def figsize(scale, nplots = 1):
1414 golden_mean = (np .sqrt (5.0 )- 1.0 )/ 2.0 # Aesthetic ratio (you could change this)
1515 fig_width = fig_width_pt * inches_per_pt * scale # width in inches
1616 fig_height = nplots * fig_width * golden_mean # height in inches
17- fig_size = [fig_width ,fig_height ]
17+ fig_size = [fig_width , fig_height ]
1818 return fig_size
1919
20- pgf_with_latex = { # setup matplotlib to use latex for output
21- "pgf.texsystem" : "pdflatex" , # change this if using xetex or lautex
22- "text.usetex" : True , # use LaTeX to write all text
23- "font.serif" : [], # blank entries should cause plots to inherit fonts from the document
24- "font.monospace" : [],
25- "axes.labelsize" : 10 , # LaTeX default is 10pt font.
26- "font.size" : 10 ,
27- "legend.fontsize" : 8 , # Make the legend/label fonts a little smaller
28- "xtick.labelsize" : 8 ,
29- "ytick.labelsize" : 8 ,
30- "figure.figsize" : figsize (1.0 ), # default fig size of 0.9 textwidth
31- "pgf.preamble" : [
32- r"\usepackage[utf8x]{inputenc}" , # use utf8 fonts becasue your computer can handle it :)
33- r"\usepackage[T1]{fontenc}" , # plots will be generated using this preamble
34- ]
35- }
36- mpl .rcParams .update (pgf_with_latex )
3720
3821import matplotlib .pyplot as plt
3922
@@ -98,11 +81,11 @@ def plot_solution_domain1D(model, domain, ub, lb, Exact_u=None, u_transpose=Fals
9881 ax .plot (domain [1 ][2 * len_ ]* np .ones ((2 ,1 )), line , 'k--' , linewidth = 1 )
9982 ax .plot (domain [1 ][3 * len_ ]* np .ones ((2 ,1 )), line , 'k--' , linewidth = 1 )
10083
101- ax .set_xlabel ('$t$ ' )
102- ax .set_ylabel ('$x$ ' )
84+ ax .set_xlabel ('t ' )
85+ ax .set_ylabel ('x ' )
10386 leg = ax .legend (frameon = False , loc = 'best' )
10487 # plt.setp(leg.get_texts(), color='w')
105- ax .set_title ('$ u(t,x)$ ' , fontsize = 10 )
88+ ax .set_title ('u(t,x)' , fontsize = 10 )
10689
10790 ####### Row 1: h(t,x) slices ##################
10891 gs1 = gridspec .GridSpec (1 , 3 )
@@ -111,33 +94,33 @@ def plot_solution_domain1D(model, domain, ub, lb, Exact_u=None, u_transpose=Fals
11194 ax = plt .subplot (gs1 [0 , 0 ])
11295 ax .plot (domain [0 ],Exact_u [:,len_ ], 'b-' , linewidth = 2 , label = 'Exact' )
11396 ax .plot (domain [0 ],U_pred [len_ ,:], 'r--' , linewidth = 2 , label = 'Prediction' )
114- ax .set_xlabel ('$x$ ' )
115- ax .set_ylabel ('$ u(t,x)$ ' )
116- ax .set_title ('$ t = %.2f$ ' % (domain [1 ][len_ ]), fontsize = 10 )
97+ ax .set_xlabel ('x ' )
98+ ax .set_ylabel ('u(t,x)' )
99+ ax .set_title ('t = %.2f' % (domain [1 ][len_ ]), fontsize = 10 )
117100 ax .axis ('square' )
118101 ax .set_xlim ([- 1.1 ,1.1 ])
119102 ax .set_ylim ([- 1.1 ,1.1 ])
120103
121104 ax = plt .subplot (gs1 [0 , 1 ])
122105 ax .plot (domain [0 ],Exact_u [:,2 * len_ ], 'b-' , linewidth = 2 , label = 'Exact' )
123106 ax .plot (domain [0 ],U_pred [2 * len_ ,:], 'r--' , linewidth = 2 , label = 'Prediction' )
124- ax .set_xlabel ('$x$ ' )
125- ax .set_ylabel ('$ u(t,x)$ ' )
107+ ax .set_xlabel ('x ' )
108+ ax .set_ylabel ('u(t,x)' )
126109 ax .axis ('square' )
127110 ax .set_xlim ([- 1.1 ,1.1 ])
128111 ax .set_ylim ([- 1.1 ,1.1 ])
129- ax .set_title ('$ t = %.2f$ ' % (domain [1 ][2 * len_ ]), fontsize = 10 )
112+ ax .set_title ('t = %.2f' % (domain [1 ][2 * len_ ]), fontsize = 10 )
130113 ax .legend (loc = 'upper center' , bbox_to_anchor = (0.5 , - 0.3 ), ncol = 5 , frameon = False )
131114
132115 ax = plt .subplot (gs1 [0 , 2 ])
133116 ax .plot (domain [0 ],Exact_u [:,3 * len_ ], 'b-' , linewidth = 2 , label = 'Exact' )
134117 ax .plot (domain [0 ],U_pred [3 * len_ ,:], 'r--' , linewidth = 2 , label = 'Prediction' )
135- ax .set_xlabel ('$x$ ' )
136- ax .set_ylabel ('$ u(t,x)$ ' )
118+ ax .set_xlabel ('x ' )
119+ ax .set_ylabel ('u(t,x)' )
137120 ax .axis ('square' )
138121 ax .set_xlim ([- 1.1 ,1.1 ])
139122 ax .set_ylim ([- 1.1 ,1.1 ])
140- ax .set_title ('$ t = %.2f$ ' % (domain [1 ][3 * len_ ]), fontsize = 10 )
123+ ax .set_title ('t = %.2f' % (domain [1 ][3 * len_ ]), fontsize = 10 )
141124
142125 plt .show ()
143126
@@ -158,10 +141,10 @@ def plot_residuals(FU_pred, extent):
158141
159142 #ax.add_collection(ec)
160143 ax .autoscale_view ()
161- ax .set_xlabel ('$x$ ' )
162- ax .set_ylabel ('$t$ ' )
144+ ax .set_xlabel ('x ' )
145+ ax .set_ylabel ('t ' )
163146 cbar = plt .colorbar (ec )
164- cbar .set_label ('$ \overline{f}_u$ prediction' )
147+ cbar .set_label ('\overline{f}_u prediction' )
165148 plt .show ()
166149
167150def get_griddata (grid , data , dims ):
0 commit comments