Plotting
In [1]:
Copied!
import torch
import agsutil
from matplotlib import pyplot
MPLP = agsutil.mpl_setup()
agsutil.print_data_signatures(MPLP,"MPLP")
import torch
import agsutil
from matplotlib import pyplot
MPLP = agsutil.mpl_setup()
agsutil.print_data_signatures(MPLP,"MPLP")
MPLP['PW'] = 30
MPLP['FS'] = 30
MPLP['COLORS'] a list of length 10
MPLP['LINESTYLES'] a list of length 10
MPLP['MARKERS'] a list of length 12
In [4]:
Copied!
fig = pyplot.figure(figsize=(MPLP["PW"],MPLP["PW"]/3*2))
gs = fig.add_gridspec(2,3)
ax0 = fig.add_subplot(gs[0,:])
x = torch.linspace(0,1,100)
for i in range(len(MPLP["COLORS"])):
ax0.plot(x,0*x+i,color=MPLP["COLORS"][i],linestyle=MPLP["LINESTYLES"][i])
ax10 = fig.add_subplot(gs[1,0],projection='3d')
x,y = torch.meshgrid(torch.linspace(-1,1,75),torch.linspace(-1,1,75),indexing="ij")
ax10.plot_surface(x,y,-x**2+y**2,cmap="gnuplot2",cstride=1,rstride=1,antialiased=False)
ax10.set_title(r"$-x^2+y^2$ surface")
ax11 = fig.add_subplot(gs[1,1])
contourf = ax11.contourf(x,y,-x**2+y**2,levels=250,cmap="gnuplot2")
fig.colorbar(contourf)
agsutil.set_aspect(ax11)
ax11.set_title(r"$-x^2+y^2$ countour")
ax12 = fig.add_subplot(gs[1,2])
for i in range(len(MPLP["MARKERS"])):
ax12.scatter([i,i+1/2],[i,i+1/2],marker=MPLP["MARKERS"][i])
agsutil.set_aspect(ax12)
fig.tight_layout()
fig = pyplot.figure(figsize=(MPLP["PW"],MPLP["PW"]/3*2))
gs = fig.add_gridspec(2,3)
ax0 = fig.add_subplot(gs[0,:])
x = torch.linspace(0,1,100)
for i in range(len(MPLP["COLORS"])):
ax0.plot(x,0*x+i,color=MPLP["COLORS"][i],linestyle=MPLP["LINESTYLES"][i])
ax10 = fig.add_subplot(gs[1,0],projection='3d')
x,y = torch.meshgrid(torch.linspace(-1,1,75),torch.linspace(-1,1,75),indexing="ij")
ax10.plot_surface(x,y,-x**2+y**2,cmap="gnuplot2",cstride=1,rstride=1,antialiased=False)
ax10.set_title(r"$-x^2+y^2$ surface")
ax11 = fig.add_subplot(gs[1,1])
contourf = ax11.contourf(x,y,-x**2+y**2,levels=250,cmap="gnuplot2")
fig.colorbar(contourf)
agsutil.set_aspect(ax11)
ax11.set_title(r"$-x^2+y^2$ countour")
ax12 = fig.add_subplot(gs[1,2])
for i in range(len(MPLP["MARKERS"])):
ax12.scatter([i,i+1/2],[i,i+1/2],marker=MPLP["MARKERS"][i])
agsutil.set_aspect(ax12)
fig.tight_layout()
In [ ]:
Copied!