Correlogram

Battery Cell Characteristics

Energy storage correlogram across lithium-ion chemistries

Output
Battery Cell Characteristics
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np

np.random.seed(222)

n = 160
chemistry = np.random.choice(['LFP', 'NMC', 'NCA'], n)
data = {
    'Capacity (Ah)': np.where(chemistry == 'NCA', np.random.normal(5, 0.5, n),
                             np.where(chemistry == 'NMC', np.random.normal(4.5, 0.4, n), np.random.normal(3.5, 0.3, n))),
    'Energy (Wh)': np.where(chemistry == 'NCA', np.random.normal(18, 2, n),
                           np.where(chemistry == 'NMC', np.random.normal(16, 1.8, n), np.random.normal(11, 1, n))),
    'Cycles': np.where(chemistry == 'LFP', np.random.normal(3000, 500, n),
                      np.where(chemistry == 'NMC', np.random.normal(1500, 300, n), np.random.normal(1000, 200, n))),
    'C-Rate': np.random.normal(2, 0.5, n),
    'Type': chemistry
}
df = pd.DataFrame(data)

plt.style.use('dark_background')
sns.set_style("darkgrid", {'axes.facecolor': '#0a0a0f', 'figure.facecolor': '#0a0a0f', 'grid.color': '#333333'})

palette = {'LFP': '#6CF527', 'NMC': '#27D3F5', 'NCA': '#F5B027'}

g = sns.pairplot(
    df,
    hue='Type',
    palette=palette,
    height=2,
    kind='reg',
    diag_kind='kde',
    markers=['o', 's', 'D'],
    plot_kws={'scatter_kws': {'alpha': 0.65, 's': 50, 'edgecolor': 'white', 'linewidths': 0.4}, 'line_kws': {'linewidth': 2}},
    diag_kws={'alpha': 0.5, 'linewidth': 2.5, 'fill': True}
)

g.fig.set_facecolor('#0a0a0f')
for ax in g.axes.flat:
    if ax:
        ax.set_facecolor('#0a0a0f')
        for spine in ax.spines.values():
            spine.set_color('#333333')
        ax.tick_params(colors='#888888')
        ax.xaxis.label.set_color('white')
        ax.yaxis.label.set_color('white')

g.fig.suptitle('Battery Chemistry Comparison', fontsize=14, fontweight='bold', color='white', y=1.02)
plt.setp(g._legend.get_title(), color='white')
plt.setp(g._legend.get_texts(), color='white')

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Statistical

Did this help you?

Support PyLucid to keep it free & growing

Support