-- the density of states of three levels, at -2, 0.5 and 3 eV with weights 0.3, 0.5 and 0.2 G = ResponseFunction.New({ {0, -2, 0.5, 3}, {0.3, 0.5, 0.2}, mu = 0, type = "ListOfPoles" }) -- a plot of -Im G / pi, broadened by a Lorentzian of 0.3 eV (full width at half maximum), at 801 energies pl = Graphics.Plot(G/Pi, 0.3, 0, 801, {{"plotRe",false}, {"Negate",true}, {"Frame",{{"Xmin",-4}, {"Xmax",4}, {"Ymin",-0.05}, {"Ymax",1.2}, {"FirstYTick",0}, {"dYTick",0.2}, {"YFormat","%.1f"}, {"XLabel","energy (eV)"}, {"YLabel","density of states"}, {"XLMargin",0.1}, {"YRMargin",0.1}, {"YAxis",-10}}}}) -- a title above the frame; the point (0.5, 0.94) is a fraction of the width and the height of the page pl.Add("three levels, broadened by 0.3 eV", 0.5, 0.94, {{"Size",0.035}, {"Alignment","c"}}) print(string.format("The page is %.1f mm wide and %.1f mm high", pl.SizeX, pl.SizeY)) -- the plot as an svg file, for a web browser, and as an encapsulated PostScript file file = io.open("DOS.svg", "w") file:write(Graphics.ToSVG(pl, {{"RelativeSize",true}})) file:close() file = io.open("DOS.ps", "w") file:write(Graphics.ToPS(pl)) file:close()