#!/usr/bin/env python3importargparseimportmatplotlibasmplimportmatplotlib.pyplotaspltimportpyro.util.io_pyroasiompl.rcParams["text.usetex"]=Truempl.rcParams['mathtext.fontset']='cm'mpl.rcParams['mathtext.rm']='serif'# font sizesmpl.rcParams['font.size']=12mpl.rcParams['legend.fontsize']='large'mpl.rcParams['figure.titlesize']='medium'# plot an output file using the solver's dovis script
[docs]defmakeplot(plotfile_name,outfile,width,height):""" plot the data in a plotfile using the solver's vis() method """sim=io.read(plotfile_name)sim.cc_data.fill_BC_all()plt.figure(num=1,figsize=(width,height),dpi=100,facecolor='w')sim.dovis()ifoutfile.endswith(".pdf"):plt.savefig(outfile,bbox_inches="tight")else:plt.savefig(outfile)plt.show()
[docs]defget_args():parser=argparse.ArgumentParser()parser.add_argument("-o",type=str,default="plot.png",metavar="plot.png",help="output file name")parser.add_argument("-W",type=float,default=8.0,metavar="width",help="width (in inches) of the plot (100 dpi)")parser.add_argument("-H",type=float,default=4.5,metavar="height",help="height (in inches) of the plot (100 dpi)")parser.add_argument("plotfile",type=str,nargs=1,help="the plotfile you wish to plot")returnparser.parse_args()