"""Plot level curves of the explicit polynomial circulation on x+y+z=1/2.""" from pathlib import Path import math import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import matplotlib.tri as tri import numpy as np N = 100 bary = np.array([(i/N, j/N, (N-i-j)/N) for i in range(N+1) for j in range(N-i+1)]) corners = np.array([[0.,0.], [1.,0.], [0.5,math.sqrt(3)/2]]) xy = bary @ corners mesh = tri.Triangulation(xy[:,0],xy[:,1]) fig, axes = plt.subplots(1,2,figsize=(7.0,2.42)) for ax, title in zip(axes,["Affine flux", "Continuum cell"]): ax.fill(*corners.T,facecolor="#f7f6fa",edgecolor="#655072",linewidth=1.1) ax.set_aspect("equal") ax.set_xlim(-.06,1.06); ax.set_ylim(-.05,.96) ax.set_title(title,fontsize=12,color="#332c3f",pad=2) ax.axis("off") axes[0].text(.5,.29,"$m=0$",ha="center",va="center",fontsize=15,color="#625a69") axis=axes[1] levels=[.005,.012,.021,.029,.0348] axis.tricontour(mesh,np.prod(bary,axis=1),levels=levels, colors=["#705280","#705280","#5a477a","#476074","#32777c"],linewidths=1.25) # The plane and xyz are both first integrals. Use exact field tangents. for level in [levels[0],levels[2],levels[4]]: roots=np.roots([2.,-1.,0.,level]) t=next(v.real for v in roots if abs(v.imag)<1e-10 and 0","color":"#523f70","mutation_scale":10,"lw":1.1, "shrinkA":0,"shrinkB":0}) fig.subplots_adjust(left=.035,right=.965,bottom=.02,top=.88,wspace=.05) fig.savefig(Path(__file__).with_name("circulation.pdf"),bbox_inches="tight",pad_inches=.025) plt.close(fig)