Python library 1.0.x

Plotting

Functions for easy plotting. Although it is focused on electrochemistry, certain parameters can be changed (like x and y labels) to plot just about anything. It will keep a predetermined format to have consistency between plots.

softpotato.plotting.plot(x, y, xlab='$E$ / V', ylab='$i$ / A', mark='-', legend=False, fig=1, show=False, fileName=False)

Description: plots x and y with a predefined format.

Parameters:

Examples:

import softpotato as sp
import numpy as np
x = np.array([1,2,3,4])
y = [x, x**2, x**3]
legend = ['$x$', '$x^2$', '$x^3$']
sp.plotting.plot(x, y, xlab='$x$', ylab='$y$', mark='-o', legend=legend, show=True)

softpotato.plotting.format(xlab, ylab, legend=False, show=False, fileName=False)

Description: function to format plots. It is called in softpotato.plotting.plot().

Parameters:

Examples:

The following code would reproduce the previous figure.

import softpotato as sp
import numpy as np
import matplotlib.pyplot as plt
x = np.array([1,2,3,4])
y = [x, x**2, x**3]
legend = ['$x$', '$x^2$', '$x^3$']
plt.figure(1)
plt.plot(x, y[0], '-o', label=legend[0])
plt.plot(x, y[1], '-o', label=legend[1])
plt.plot(x, y[2], '-o', label=legend[2])
sp.plotting.format(xlab='$x$', ylab='$y$', legend=legend, show=True)