"""Poissonized displayed-library occupancy, Python 3.14 + NumPy/Matplotlib. Run in mirrored _media; write a white PNG to the current directory. The complete-coverage curve assumes independent Poisson counts, not a fixed number of usable molecules. No experimental data are plotted. """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt variants = 1000 mean_count = np.linspace(0.0, 14.0, 1001) represented = -np.expm1(-mean_count) complete = represented**variants fig, ax = plt.subplots(figsize=(9.6, 4.2), dpi=100, facecolor='white') ax.set_facecolor('white') ax.plot(mean_count, represented, lw=2.5, color='#1261a0', label='Expected represented fraction') ax.plot(mean_count, complete, lw=2.5, color='#d46216', label='Probability all 1000 variants are present') ax.axvline(3.0, lw=1, color='#777777', linestyle='--') ax.annotate('Mean coverage ≈95%\nComplete coverage ≈0', (3.0, -np.expm1(-3.0)), xytext=(4.1, 0.64), arrowprops={'arrowstyle': '->', 'color': '#555555'}, fontsize=10) ax.set(xlim=(0, 14), ylim=(0, 1.04), xlabel='Mean usable molecules per variant, λ', ylabel='Expected fraction / probability', title='Library coverage: representing most variants is easier than representing all') ax.grid(alpha=0.2) ax.legend(loc='lower right', frameon=False) fig.text(0.5, 0.02, 'Original model: 1000 equally represented variants; independent Poisson counts. No measured data.', ha='center', fontsize=9) fig.tight_layout(rect=(0, 0.04, 1, 1)) fig.savefig('display-library-mean-versus-complete-coverage.png', dpi=100, facecolor='white') plt.close(fig)