-- a response function with three poles, at -2, 0.5 and 3 eV with weights 0.3, 0.5 and 0.2, -- and a spectrum made from it, broadened by a Lorentzian of 0.2 eV G = ResponseFunction.New({ {0, -2, 0.5, 3}, {0.3, 0.5, 0.2}, mu = 0, type = "ListOfPoles" }) S = ResponseFunction.ToSpectra(G, {{"Emin",-5}, {"Emax",5}, {"NE",1000}, {"GammaL",0.2}}) -- write a Graphics object to an svg file that fills the window of a web browser function Save(pl, name) local file = io.open(name..".svg", "w") file:write(Graphics.ToSVG(pl, {{"RelativeSize",true}})) file:close() end -- 1. without options: the real part red and the imaginary part blue, the vertical axis from -1 to 1 Save(Graphics.Plot(S), "Plot_1_default") -- 2. the intensity -Im S, in a frame chosen by hand Frame = {{"Xmin",-4}, {"Xmax",4}, {"Ymin",-0.2}, {"Ymax",5.5}, {"FirstYTick",0}, {"dYTick",1}, {"XLabel","energy (eV)"}, {"YLabel","intensity"}, {"XLMargin",0.1}, {"YAxis",-10}} Save(Graphics.Plot(S, {{"plotRe",false}, {"Negate",true}, {"Frame",Frame}}), "Plot_2_intensity") -- 3. the response function itself, broadened by a Lorentzian of 0.2 eV; the energies are those of the frame Save(Graphics.Plot(G, 0.2, {{"Frame",{{"Xmin",-4}, {"Xmax",4}, {"Ymin",-5.5}, {"Ymax",5.5}, {"FirstYTick",-4}, {"dYTick",2}, {"XLabel","energy (eV)"}, {"YLabel","G(E)"}, {"XLMargin",0.1}}}}), "Plot_3_response_function") -- 4. four curves in one frame, the intensity broadened by 0.2, 0.3, 0.5 and 0.8 eV, alternating orange and green Curves = {} for k, Gamma in ipairs({0.2, 0.3, 0.5, 0.8}) do Curves[k] = ResponseFunction.ToSpectra(G, {{"Emin",-5}, {"Emax",5}, {"NE",1000}, {"GammaL",Gamma}}) end Orange = {{"LineWidth",0.003}, {"LineColor",0xFF8000}} Green = {{"LineWidth",0.003}, {"LineColor",0x00A000}} Save(Graphics.Plot(Curves, {{"plotRe",false}, {"Negate",true}, {"Frame",Frame}, {"LineStyle",{Orange, Green}}, {"LineStyleCycle",2}}), "Plot_4_several_curves") -- 5. the same curves as a waterfall plot, in the default styles, made smaller by Scale and each shifted up by 2 from the one before Save(Graphics.Plot(Curves, {{"plotRe",false}, {"Negate",true}, {"Scale",0.35}, {"WaterfallShift",2}, {"Frame",{{"Xmin",-4}, {"Xmax",4}, {"YTicks",false}, {"XAxis",-10}, {"YAxis",-10}, {"XLabel","energy (eV)"}, {"YLabel","intensity, shifted"}, {"XLMargin",0.06}}}}), "Plot_5_waterfall") -- 6. the levels split by Delta from 0 to 3 eV, as a color map with Delta on the vertical axis Series = {} for k = 0, 60 do local Delta = 0.05*k Series[k+1] = ResponseFunction.ToSpectra(ResponseFunction.New({ {0, -0.4*Delta, 0.6*Delta}, {0.4, 0.6}, mu = 0, type = "ListOfPoles" }), {{"Emin",-3}, {"Emax",3}, {"NE",600}, {"GammaL",0.2}}) end Save(Graphics.Plot(Series, {{"plotRe",false}, {"Negate",true}, {"WaterfallOffset",0}, {"WaterfallShift",0.05}, {"ColorMap",true}, {"Color",0x0000C0}, {"Saturation",0.2}, {"NPixelX",300}, {"NPixelY",300}, {"Frame",{{"Xmin",-2}, {"Xmax",3}, {"dYTick",0.5}, {"YFormat","%.1f"}, {"XAxis",-10}, {"YAxis",-10}, {"XLabel","energy (eV)"}, {"YLabel","Delta (eV)"}, {"XLMargin",0.1}}}}), "Plot_6_color_map")