def figures_preparation(computing_parameters):
""" This function create the required figures and axes according to the type_current and type_display.
Parameters
----------
computing_parameters : dict
Dictionary containing the computing parameters for the simulation.
Returns
-------
fig1 : matplotlib.figure.Figure
Figure for the first plot.
ax1 : matplotlib.axes._subplots.AxesSubplot
Axes for the first plot.
fig2 : matplotlib.figure.Figure
Figure for the second plot.
ax2 : matplotlib.axes._subplots.AxesSubplot
Axes for the second plot.
"""
mpl.rcParams['font.family'] = 'cmr10' # 'cmr10' for English characters and 'DejaVu Serif' for French ones
mpl.rcParams['axes.formatter.use_mathtext'] = True # For the scientific notation
mpl.rcParams['lines.linewidth'] = 2.0
mpl.rcParams['lines.markersize'] = 5.0
if computing_parameters['type_display'] == "no_display":
fig1, ax1 = None, None
fig2, ax2 = None, None
fig3, ax3 = None, None
# For the step current
if computing_parameters['type_current'] == "step":
if computing_parameters['type_display'] == "multiple": # saving instruction is directly implemented within AlphaPEM.Display here.
mpl.rcParams['font.size'] = 18 # Font size for all text
fig1, ax1 = None, None # Here, additional plots are unnecessary
fig2, ax2 = None, None # Here, additional plots are unnecessary
fig3, ax3 = None, None # Here, additional plots are unnecessary
elif computing_parameters['type_display'] == "synthetic":
mpl.rcParams['font.size'] = 13 # Font size for all text
fig1, ax1 = plt.subplots(3, 3, figsize=(14, 14))
fig2, ax2 = None, None # Here, additional plots are unnecessary
fig3, ax3 = None, None # Here, additional plots are unnecessary
plt.subplots_adjust(left=0.04, right=0.98, top=0.96, bottom=0.07, wspace=0.2, hspace=0.15)
# For the polarization curve
elif computing_parameters['type_current'] == "polarization":
if computing_parameters['type_display'] == "multiple":
mpl.rcParams['font.size'] = 11 # Font size for all text
fig1, ax1 = plt.subplots(1, 3, figsize=(14, 4.7))
fig2, ax2 = plt.subplots(1, 3, figsize=(14, 4.7))
fig3, ax3 = None, None # Here, additional plots are unnecessary
plt.subplots_adjust(left=0.04, right=0.98, top=0.96, bottom=0.07, wspace=0.2, hspace=0.15)
elif computing_parameters['type_display'] == "synthetic":
mpl.rcParams['font.size'] = 18 # Font size for all text
fig1, ax1 = plt.subplots(figsize=(8, 8))
fig2, ax2 = None, None # Here, additional plots are unnecessary
fig3, ax3 = None, None # Here, additional plots are unnecessary
# For the polarization curve used for the calibration
elif computing_parameters['type_current'] == "polarization_for_cali":
if computing_parameters['type_display'] == "multiple":
mpl.rcParams['font.size'] = 11 # Font size for all text
fig1, ax1 = plt.subplots(1, 3, figsize=(14, 4.7))
fig2, ax2 = None, None # Here, additional plots are unnecessary
fig3, ax3 = None, None # Here, additional plots are unnecessary
plt.subplots_adjust(left=0.04, right=0.98, top=0.96, bottom=0.07, wspace=0.2, hspace=0.15)
elif computing_parameters['type_display'] == "synthetic":
mpl.rcParams['font.size'] = 18 # Font size for all text
fig1, ax1 = plt.subplots(figsize=(8, 8))
fig2, ax2 = None, None # Here, additional plots are unnecessary
fig3, ax3 = None, None # Here, additional plots are unnecessary
# For the EIS curve
elif computing_parameters['type_current'] == "EIS":
if computing_parameters['type_display'] == "multiple":
mpl.rcParams['font.size'] = 18 # Font size for all text
fig1, ax1 = plt.subplots(figsize=(8, 8))
fig2, ax2 = plt.subplots(figsize=(8, 8))
fig3, ax3 = plt.subplots(figsize=(8, 8))
elif computing_parameters['type_display'] == "synthetic":
mpl.rcParams['font.size'] = 13 # Font size for all text
fig1, ax1 = plt.subplots(1, 3, figsize=(14, 4.7))
fig2, ax2 = None, None # Here, additional plots are unnecessary
fig3, ax3 = None, None # Here, additional plots are unnecessary
plt.subplots_adjust(left=0.04, right=0.98, top=0.96, bottom=0.07, wspace=0.2, hspace=0.15)
return fig1, ax1, fig2, ax2, fig3, ax3