Line & Scatter

Exponential Growth Curve

Exponential growth displayed on linear scale showing the characteristic curve.

Output
Exponential Growth Curve
Python
import matplotlib.pyplot as plt
import numpy as np

# === STYLE CONFIG ===
COLORS = {
    'line': '#F59E0B',
    'fill': '#F59E0B',
    'points': '#F59E0B',
    'background': '#FAFBFC',
    'text': '#1E293B',
    'text_muted': '#64748B',
    'grid': '#E2E8F0',
}

# === DATA ===
x = np.linspace(0, 10, 100)
y = 10 * (2 ** (x / 2))  # Exponential growth

x_points = np.arange(0, 11, 2)
y_points = 10 * (2 ** (x_points / 2))

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

# === PLOT ===
# Fill under curve
ax.fill_between(x, 0, y, color=COLORS['fill'], alpha=0.15)

# Main curve with glow
for lw, alpha in [(8, 0.1), (4, 0.2)]:
    ax.plot(x, y, color=COLORS['line'], linewidth=lw, alpha=alpha)
ax.plot(x, y, color=COLORS['line'], linewidth=2.5, label='y = 10 * 2^(x/2)')

# Data points
ax.scatter(x_points, y_points, color=COLORS['points'], s=80,
           edgecolors='white', linewidths=2, zorder=5)

# Annotations for key values
for xi, yi in zip(x_points[::2], y_points[::2]):
    ax.annotate(str(int(yi)), xy=(xi, yi), xytext=(5, 10),
                textcoords='offset points', fontsize=9,
                color=COLORS['text_muted'])

# === AXES ===
ax.set_xlim(0, 10)
ax.set_ylim(0, 350)
ax.set_xlabel('Time', fontsize=10, color=COLORS['text_muted'], labelpad=10)
ax.set_ylabel('Value (linear scale)', fontsize=10, color=COLORS['text_muted'], labelpad=10)

# === 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=0.5, alpha=0.7)
ax.xaxis.grid(False)
ax.set_axisbelow(True)
ax.tick_params(axis='both', colors=COLORS['text_muted'], labelsize=9, length=0, pad=8)

ax.legend(loc='upper center', bbox_to_anchor=(0.5, -0.12),
          ncol=1, frameon=False, fontsize=9, labelcolor=COLORS['text_muted'])

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Pairwise Data

Did this help you?

Support PyLucid to keep it free & growing

Support