Skip to content

Instantly share code, notes, and snippets.

@FredrikMeyer
Last active April 2, 2024 14:22
Show Gist options
  • Save FredrikMeyer/2b2a4fffe77b0997282f40a601b443fd to your computer and use it in GitHub Desktop.
Save FredrikMeyer/2b2a4fffe77b0997282f40a601b443fd to your computer and use it in GitHub Desktop.
2dtree (graphviz + gnuplot)
digraph {
node [ shape = record, height=.1];
node0[label = "<f0> lower |<f1> pt: [0.5 0.5] |<f2> higher"];
node1[label = "<f0> lower |<f1> pt: [0.6 0.3] |<f2> higher"];
node2[label = "<f0> lower |<f1> pt: [0.7 0.8] |<f2> higher"];
node3[label = "<f0> lower |<f1> pt: [0.4 0.8] |<f2> higher"];
node4[label = "<f0> lower |<f1> pt: [0.4 0.6] |<f2> higher"];
"node0":f2 -> "node1":f1;
node1:f2 -> node2:f1;
node0:f0 -> node3:f1;
node3:f0 -> node4:f1;
}
reset
unset key;
set title "2d Tree Visualization";
set label '[0.5 0.5]' at 0.5,0.5 left offset char 1,1;
set label '[0.6 0.3]' at 0.6,0.3 left offset char 1,-1;
set label '[0.7 0.8]' at 0.7,0.8 left offset char 1;
set label '[0.4 0.8]' at 0.4,0.8 left offset char -1,1;
set label '[0.4 0.6]' at 0.4,0.6 right offset char -0.5,1;
set xrange [0:1];
set yrange [0:1];
set style line 1 lc rgb 'black' pt 7;
plot '-' with points ls 1, \
'-' with lines ls 1
# Points data
0.5 0.5
0.6 0.3
0.7 0.8
0.4 0.8
0.4 0.6
e
# Lines data
0.5 0.0
0.5 1
0.5 0.3
1 0.3
0.7 0.3
0.7 1
0.0 0.8
0.5 0.8
0.4 0
0.4 0.8
e
@FredrikMeyer
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment