Open ezio-melotti opened 2 years ago
I prefer #4
On 8/3/22 15:37, Ezio Melotti wrote:
This PR is a proof of concept that updates the
Branch.display_viz()
method to use Unicode-art instead of ASCII-art.This is an example of the new representation:
╭────┤+├──────────────────────╮ ╭──────────┤+├──────────╮ b ╭────┤+├────╮ ╭────┤+├────╮ b b c a
Or as a screenshot from my terminal:
I also played around with a few different representations:
- without rounded corners and nothing around the operator:
┌───────────────────────*─────┐ a ┌─────*─────────────────┐ ┌───────────-─────┐ a b ┌─────-─────┐ a a
with rounded corners and nothing around the operator:
╭─────────/───────────────────╮ ╭────*──────────────╮ ╭────+────╮ ╭─────────-────╮ c c b a ╭────/────╮ a c
- with rounded corners and
[ ]
around the operators:╭───[+]───────────────────────╮ ╭──────────────────[-]───╮ c b ╭────────[+]────────╮ ╭───[-]───╮ ╭───[-]───╮ b c a c
- with rounded corners and
┤ ├
around the operators (the proposed one, shown at the top).TODO:
- [ ] decide which representation to adopt
- [ ] fix tests accordingly
- [ ] possibly add a
unicode=True
argThere are also a few items that don't seem directly related to this PR, but should be fixed in a separate PR:
- [ ] fix some alignment issues
- [ ] handle functions/operators with len > 1
[ ] handle deep tree You can view, comment on, or merge this pull request online at:
-- Commit Summary --
- Use Unicode-art for the tree display.
-- File Changes --
M karoo_gp/branch.py (15)
-- Patch Links --
https://github.com/kstaats/karoo_gp/pull/83.patch https://github.com/kstaats/karoo_gp/pull/83.diff
I also like Number 4.
re: 'deep tree', I thought of adding an option to clip the display at the bottom and/or top, to guarantee readability. There are some details to work out, but here's an idea:
(+3 hidden)
╭────┤+├──────────────────────╮
╭──────────┤+├──────────╮ b
╭────┤+├────╮ ╭────┤+├────╮
b b |+| |-|
(+4 hidden) (+2 hidden)
Another useful feature would be to highlight one node, or a node + all nodes below it. I'm close to adding click
for my work on the interactive mode, which I'm sure we can co-opt for this.
Another useful feature would be to highlight one node, or a node + all nodes below it.
Unicode provides a range of characters that can be used for that, e.g. this could be used to highlight the bottom-left operator:
╭────┤+├──────────────────────╮
╭──────────┤+├──────────╮ b
╭────╢+╟────╮ ╭────┤+├────╮
b b c a
There are also double lines, but not for rounded corners.
We could also make it fancier: however this is more complicated to achieve and takes 2x many lines compared to the other version:
Keep in mind that with larger datasets we'll employ much larger trees. This visualization works well for small trees, but when they have 100+ nodes, it will wrap on-screen, no?
On 8/3/22 19:44, Grant wrote:
I also like Number 4.
re: 'deep tree', I thought of adding an option to clip the display at the bottom and/or top, to guarantee readability. There are some details to work out, but here's an idea:
(+3 hidden) ╭────┤+├──────────────────────╮ ╭──────────┤+├──────────╮ b ╭────┤+├────╮ ╭────┤+├────╮ b b |+| |-| (+4 hidden) (+2 hidden)
Another useful feature would be to highlight one node, or a node + all nodes below it. I'm close to adding
click
for my work on the interactive mode, which I'm sure we can co-opt for this.
Yes, this is the last item in the checklist in my first message -- this PR was mostly a proof of concept. We discussed a different tree-style representation for larger sets too. I can go back to this before the release of 3.0 and implement both.
For Karoo 3.0:
Future updates:
This PR is a proof of concept that updates the
Branch.display_viz()
method to use Unicode-art instead of ASCII-art.This is an example of the new representation:
Or as a screenshot from my terminal:
I also played around with a few different representations:
with rounded corners and nothing around the operator:
[ ]
around the operators:┤ ├
around the operators (the proposed one, shown at the top).TODO:
unicode=True
argThere are also a few items that don't seem directly related to this PR, but should be fixed in a separate PR: