Stem Plot

Modern Stem Plot

Clean stem visualization with glow markers.

Output
Modern Stem Plot
Python
import matplotlib.pyplot as plt
import numpy as np

# === STYLE CONFIG ===
COLORS = {
    'stem': '#6366F1',
    'marker': '#6366F1',
    'background': '#FFFFFF',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#F1F5F9',
}

# === DATA ===
x = np.arange(1, 9)
y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0]

# === FIGURE ===
fig, ax = plt.subplots(figsize=(10, 6), dpi=100)
ax.set_facecolor(COLORS['background'])
fig.patch.set_facecolor(COLORS['background'])

# === PLOT ===
# Glow effect on markers
ax.scatter(x, y, s=200, c=COLORS['marker'], alpha=0.2, zorder=2)

# Stem lines with custom style
markerline, stemlines, baseline = ax.stem(x, y, linefmt='-', markerfmt='o', basefmt=' ')
plt.setp(stemlines, color=COLORS['stem'], linewidth=2, alpha=0.7)
plt.setp(markerline, color=COLORS['marker'], markersize=10, 
         markeredgecolor='white', markeredgewidth=2, zorder=3)

# === STYLING ===
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_color(COLORS['grid'])
ax.spines['bottom'].set_color(COLORS['grid'])

ax.yaxis.grid(True, color=COLORS['grid'], linewidth=1, zorder=0)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)

ax.set_xlim(0, 9)
ax.set_ylim(0, 8)
ax.set_xlabel('Category', fontsize=10, color=COLORS['text'], labelpad=10)
ax.set_ylabel('Value', fontsize=10, color=COLORS['text'], labelpad=10)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Basic Charts

Did this help you?

Support PyLucid to keep it free & growing

Support