From 6fb1c813dbe2227dab3faac3fc405260be185eca Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Wed, 24 Jan 2024 10:02:08 -0600 Subject: Bump up the font size, making the overall image "more compact." --- discocaml/draw_tree.ml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/discocaml/draw_tree.ml b/discocaml/draw_tree.ml index 6b6ce91..14c08af 100644 --- a/discocaml/draw_tree.ml +++ b/discocaml/draw_tree.ml @@ -4,7 +4,7 @@ module IntSet = Set.Make (Int) let fmt_with_possible_subscript (fmt : Format.formatter) (s : string) : unit = match Util.break_to_subscript s with | Some (name, sub) -> - Format.fprintf fmt "<%s%d>" name + Format.fprintf fmt "<%s%d>" name sub | None -> Format.fprintf fmt "%S" s @@ -68,13 +68,13 @@ let add_expr_edges (ast : 'a ast) (fmt : Format.formatter) edge_to else_ | Lam (x, b) -> Format.fprintf fmt " expr%d -> expr%d_var;\n" i.index i.index; - Format.fprintf fmt " expr%d_var [label=%a];\n" i.index - fmt_with_possible_subscript x; + Format.fprintf fmt " expr%d_var [label=%a, shape=\"ellipse\"];\n" + i.index fmt_with_possible_subscript x; edge_to b | Let (_, name, bound, body) -> Format.fprintf fmt " expr%d -> expr%d_var;\n" i.index i.index; - Format.fprintf fmt " expr%d_var [label=%a];\n" i.index - fmt_with_possible_subscript name; + Format.fprintf fmt " expr%d_var [label=%a, shape=\"ellipse\"];\n" + i.index fmt_with_possible_subscript name; edge_to bound; edge_to body | Prim (Add, (l, r)) -> @@ -98,7 +98,9 @@ let draw_tree (ast : expr ast) : string = let buf = Buffer.create 16 and nodes = ref IntSet.empty in let fmt = Format.formatter_of_buffer buf in Format.fprintf fmt "digraph {\n"; - Format.fprintf fmt " node [shape=\"box\", style=\"rounded\"];\n"; + Format.fprintf fmt + " node [fontsize=\"20pt\", penwidth=\"2.0\", shape=\"box\", \ + style=\"rounded\"];\n"; add_expr_edges ast fmt nodes ast.root; Format.fprintf fmt "\n"; -- cgit v1.2.3