import sys, zipfile, matplotlib; matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator, FuncFormatter zpath, out = sys.argv[1], sys.argv[2] z=zipfile.ZipFile(zpath); cache={} def year(y): if y not in cache: cache[y]={(n,s):int(k) for n,s,k in (l.split(',') for l in z.read(f'yob{y}.txt').decode().splitlines())} return cache[y] panels=[('Kylo','M',2008,2015,'Kylo Ren debut, 2015'),('Arya','F',2004,2011,'Game of Thrones premiere, 2011'), ('Kayce','M',2011,2018,'Yellowstone premiere, 2018'),('Daenerys','F',2004,2011,'Game of Thrones premiere, 2011'), ('Arwen','F',1994,2001,'Fellowship of the Ring film, 2001'),('Eleven','F',2009,2016,'Stranger Things premiere, 2016')] BLUE='#2a78d6'; INK='#0b0b0b'; SEC='#52514e'; GRID='#e4e3df'; SURF='#fcfcfb' fig,axes=plt.subplots(2,3,figsize=(12,7.2),dpi=150,facecolor=SURF) for ax,(n,s,y0,a,lab) in zip(axes.flat,panels): xs=list(range(y0,2026)); ys=[year(y).get((n,s),0) for y in xs]; top=max(ys) ax.set_facecolor(SURF); ax.plot(xs,ys,color=BLUE,lw=2,solid_capstyle='round') ax.axvline(a,color=SEC,lw=1,ls=(0,(3,3))) ax.scatter([2025],[ys[-1]],s=22,color=BLUE,zorder=3,edgecolor=SURF,linewidth=1.5) ax.set_title(f"{n} ({'girls' if s=='F' else 'boys'})",fontsize=11,color=INK,loc='left',fontweight='bold',pad=22) ax.text(0,1.02,f"Dashed line: {lab} ยท {ys[-1]:,} in 2025",transform=ax.transAxes,fontsize=8,color=SEC,va='bottom') ax.set_ylim(0,top*1.08); ax.grid(axis='y',color=GRID,lw=0.8); ax.set_axisbelow(True) ax.xaxis.set_major_locator(MaxNLocator(integer=True,nbins=5)) for sp in ['top','right']: ax.spines[sp].set_visible(False) for sp in ['left','bottom']: ax.spines[sp].set_color(GRID) ax.tick_params(colors=SEC,labelsize=8); ax.yaxis.set_major_formatter(FuncFormatter(lambda v,p:f"{int(v):,}")) fig.suptitle('US babies given the name each year, before and after the show',x=0.01,ha='left',fontsize=14,color=INK,fontweight='bold') fig.text(0.01,0.005,'Source: US Social Security Administration national baby-name data, 1880-2025. Names with fewer than 5 births in a year are not published, shown here as 0. Each panel has its own scale. Chart: StashGrid.',fontsize=7.5,color=SEC) fig.tight_layout(rect=(0,0.03,1,0.95)); fig.savefig(out,facecolor=SURF)