Skip to content

Plotting and modulus analysis

The plot functions draw into Matplotlib axes that you create. Thus you control the figure size, the layout and the legend. A dictionary sets the appearance of the points, for example {"marker": "o", "ls": "", "color": "black"}. The plot functions give this dictionary to Matplotlib.

Nyquist plot

import matplotlib.pyplot as plt
from EISFitpython import EISFit_main as fit

fig, ax = plt.subplots()
fit.nyquistPlot(
    ax,
    Z,
    {"marker": "o", "ls": "", "color": "black", "label": "Data"},
)
ax.legend()

nyquistPlot plots \(-Z''\) as a function of \(Z'\) with equal scales on the two axes. It selects the unit (\(\Omega\), k\(\Omega\), M\(\Omega\) or G\(\Omega\)) from the largest impedance of the data.

Note

The function selects the unit again in each call. Two data sets in the same axes can thus get different units, for example data with a maximum of 999 Ω and data with a maximum of 1001 Ω. In that condition, divide the two data sets by the same factor before you plot them.

Bode plot

fig, axes = plt.subplots(2, 1, sharex=True)
fit.bodePlot(
    axes,
    f,
    Z,
    {"marker": "o", "ls": "", "color": "black"},
    plot_types=["magnitude", "phase"],
)

plot_types lists the quantities to plot as a function of the frequency: magnitude, phase, real or imaginary. Give one axes object for each item in the list. Without plot_types, the function plots the imaginary part and the phase.

To draw many spectra with one common unit, give all of them as all_Z=[Z1, Z2, ...].

Data and fit in one call

plot_fit(f, Z, Z_fit, plot_type) draws the data and the fitted curve. It saves the figures and shows them. plot_type is "nyquist", "bode" or "both". full_EIS_report calls this function automatically.

Electric modulus

The electric modulus shows a process with a small capacitance, such as the bulk response, more clearly than the impedance. The function calculates the modulus from the impedance and the capacitance of the empty cell \(C_0\):

\[ M^* = j\omega C_0 Z^*, \qquad C_0 = \frac{\epsilon_0 A}{l}. \]

Thus \(M' = -\omega C_0 Z''\) and \(M'' = \omega C_0 Z'\). For a capacitive sample, the two parts are positive. A resistor in parallel with a capacitor gives a peak in \(M''\) at the frequency \(1/(2\pi RC)\).

fig, ax = plt.subplots()
fit.modulus_plot(
    [ax],
    f,
    Z,
    {"marker": "o", "ls": "", "color": "black"},
    diameter=0.8,
    thickness=0.21,
    plot_types=["imaginary"],
)

diameter and thickness are the dimensions of the pellet in centimeters. plot_types is magnitude, real or imaginary. Without plot_types, the function plots the imaginary part \(M''\).

Arrhenius plot

EA(ax, T, conductivity, plot_params) uses temperatures in kelvin and conductivities in S/cm. It fits a straight line to \(\ln(\sigma T)\) as a function of \(1000/T\). It prints three results with their standard errors:

  • the activation energy,
  • the pre-exponential factor,
  • the conductivity at room temperature.

It also draws the data and the fitted line. plot_arrhenius calls this function automatically (see Batch and Arrhenius analysis).