Faceted Scatter Plot
Protein Expression by Cell Line
Multi-panel western blot quantification across model systems
Output
Python
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
np.random.seed(444)
cell_lines = ['HeLa', 'HEK293', 'MCF7', 'A549']
data = []
for cell in cell_lines:
n = 38
stimulus = np.random.uniform(0, 100, n)
responses = {'HeLa': 0.45, 'HEK293': 0.55, 'MCF7': 0.38, 'A549': 0.42}
expression = responses[cell] * np.log(stimulus + 1) + np.random.normal(0, 0.2, n)
for s, e in zip(stimulus, expression):
data.append({'Stimulus (nM)': s, 'Expression (AU)': e, 'Cell Line': cell})
df = pd.DataFrame(data)
# Light theme
sns.set_style("whitegrid", {
'axes.facecolor': '#ffffff',
'figure.facecolor': '#ffffff',
'grid.color': '#eeeeee',
'axes.edgecolor': '#cccccc',
'axes.labelcolor': '#333333',
'text.color': '#333333',
'xtick.color': '#666666',
'ytick.color': '#666666'
})
palette = ['#F5276C', '#4927F5', '#6CF527', '#F5B027']
g = sns.lmplot(
data=df,
x='Stimulus (nM)',
y='Expression (AU)',
hue='Cell Line',
col='Cell Line',
col_wrap=2,
height=3.5,
aspect=1.2,
palette=palette,
scatter_kws={'alpha': 0.75, 's': 55, 'edgecolor': 'white', 'linewidths': 0.8},
line_kws={'linewidth': 2.5},
ci=95
)
g.fig.set_facecolor('#ffffff')
for ax in g.axes.flat:
ax.set_facecolor('#ffffff')
for spine in ax.spines.values():
spine.set_color('#dddddd')
g.fig.suptitle('Stimulus-Response by Cell Model', fontsize=14, fontweight='bold', color='#1a1a1a', y=1.02)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
Pairwise Data
More Faceted Scatter Plot examples
☕