"""Draw an ideal 20-division vernier reading 12.35 mm. Python 3.14; Matplotlib 3.10.7. Run in the media directory; PNG goes to cwd. Main spacing is 1 mm, vernier spacing 19/20 mm; graduation7 aligns at19 mm. """ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt zero=12.35 fig,ax=plt.subplots(figsize=(8.8,3.1),facecolor='white') fig.subplots_adjust(left=.035,right=.985,bottom=.12,top=.79) ax.set(xlim=(10.8,33.1),ylim=(0,1.1));ax.axis('off') ax.plot([11,33],[.74,.74],color='#344454',lw=1.4) for x in range(11,34): ax.plot([x,x],[.74,.59],color='#344454',lw=1.1) if x%2==0:ax.text(x,.82,str(x),ha='center',fontsize=10) ax.plot([zero,zero+19],[.30,.30],color='#245b9c',lw=1.5) for j in range(21): x=zero+.95*j col='#2c864b' if j==7 else '#245b9c' ax.plot([x,x],[.30,.45],color=col,lw=2 if j==7 else 1.1) if j in [0,5,7,10,15,20]:ax.text(x,.13,str(j),ha='center',fontsize=10,color=col) ax.plot([19,19],[.3,.74],ls='--',lw=1.4,color='#2c864b') ax.annotate('graduation 7 coincides',xy=(19,.53),xytext=(21.8,.51),fontsize=10, arrowprops={'arrowstyle':'->','color':'#2c864b'},color='#235e37') ax.annotate('vernier zero',xy=(zero,.3),xytext=(11.1,.02),fontsize=10, arrowprops={'arrowstyle':'->','color':'#245b9c'},color='#245b9c') ax.text(11.2,1.02,'Main scale (mm)',fontsize=10) fig.suptitle('A coincidence turns a small offset into a readable index',fontsize=13,y=.96) fig.text(.5,.035,'20 vernier intervals span 19 mm: reading = 12 mm + 7×0.05 mm = 12.35 mm', ha='center',fontsize=11) fig.savefig('vernier-scale-coincidence.png',dpi=120,facecolor='white')