def figures_preparation(type_current, type_display):
""" This function create the required figures and axes according to the type_current and type_display.
Parameters
----------
type_current : str
Type of current density function.
type_display : str
Type of display.
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 type_display == "no_display":
fig1, ax1 = None, None
fig2, ax2 = None, None
fig3, ax3 = None, None
# For the step current
if type_current == "step":
if 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 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 type_current == "polarization":
if 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 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 type_current == "EIS":
if 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 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