-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Unicode-art for the tree display. #83
base: master
Are you sure you want to change the base?
Conversation
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:
![image](https://user-images.githubusercontent.com/25624924/182723607-6a1b1493-fa92-4cfc-b7b5-3cd0d8dc3ae2.png)
I also played around with a few different representations:
1. without rounded corners and nothing around the operator:
```
┌───────────────────────*─────┐
a ┌─────*─────────────────┐
┌───────────-─────┐ a
b ┌─────-─────┐
a a
```
2. with rounded corners and nothing around the operator:
```
╭─────────/───────────────────╮
╭────*──────────────╮ ╭────+────╮
╭─────────-────╮ c c b
a ╭────/────╮
a c
```
3. with rounded corners and `[ ]` around the operators:
```
╭───[+]───────────────────────╮
╭──────────────────[-]───╮ c
b ╭────────[+]────────╮
╭───[-]───╮ ╭───[-]───╮
b c a c
```
4. 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` arg
There 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:
#83
-- 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:
Another useful feature would be to highlight one node, or a node + all nodes below it. I'm close to adding |
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. |
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:
[ ]
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: