require ("xfig"); define read_data (file, ncol, expr_col) { variable s = struct { n, expr }; (s.n, s.expr) = readcol (file, ncol, expr_col); return s; } define make_plot () { variable slang = read_data ("data/slang_discr.dat", 1,2); variable numarray = read_data ("data/python_discr.dat", 1,3); variable numeric = read_data ("data/python_discr.dat", 1,2); variable w = xfig_plot_new (); xfig_plot_define_world (w, 1, max(slang.n), 0, 1); xfig_plot_add_x_axis (w, 1, "Array Size"R); xfig_plot_add_y_axis (w, 0, "Fraction of S-Lang Speed"R); xfig_plot_set_line_color (w, "red"); xfig_plot_lines (w, slang.n, slang.expr/numeric.expr); xfig_plot_set_line_color (w, "blue"); xfig_plot_lines (w, slang.n, slang.expr/numarray.expr); variable legend = xfig_new_legend (["Numeric", "numarray"], ["red", "blue"], 0, 2, 2); xfig_plot_add_object (w, legend, 40, 0.7); xfig_plot_title (w, "\Large Evaluation of $\sqrt{b^2-4ac}$"R); xfig_render_object (w, "numarray.png"); } make_plot(); exit(0);