tammoippen / plotille

Plot in the terminal using braille dots.
MIT License
398 stars 17 forks source link

Some ideas for optimization. #22

Closed carlosplanchon closed 5 years ago

carlosplanchon commented 5 years ago

Well, I've made a small library for resampling data to use on functions plot and scatter of plotille. https://github.com/carlosplanchon/plotilleresample """ Rationale:

tammoippen commented 5 years ago

1 - Make optimizations before rendering to avoid useless computations

I recently thought about something similar. Would you consider opening a pull request? Or is it ok, if I start integrating it based on your lib?

2 - Separate Canvas module so it can be used as a dependency on plotille, maybe drawille, and potentially on other projects.

I will have a look into this...

carlosplanchon commented 5 years ago

Yeah, integrate it based on my lib or even my code if you want. On 2018 I was experimenting with something like what you are doing now and it's great to see you came with a better solution: https://github.com/carlosplanchon/outfancy/blob/master/outfancy/chart.py (I'll remove plotting functions on Outfancy in the next version 'cause plotille is already doing it).

tammoippen commented 5 years ago

Regarding the optimization: i decided against integrating it into plotille, as the approach will not fit for every data, especially high frequency data might get under-sampled. There min, max, median resample might be a better approach. Hence i leave it to the user to reduce the input to some appropriate size.

I will again look into separating the project... i kind of got distracted.. 😳

tammoippen commented 5 years ago

Regarding the splitting: when I start with a canvas module, i also have to include color, and part of utils, which I also need in the other parts of this package. This means I either have code duplication in both packages or more small packages or both... I also have to manage version compatibility between these packages... neither sounds nice to me for this small project.

Further, the gain is not so dramatic: it is possible to install plotille right now to use both Canvas and color without ever touching the other plotting functions, all at the cost of 3 more unused .py files (approx. 31kb).

maybe drawille, and potentially on other projects [...will use this Canvas].

Drawille did not change since end of 2017 - i would be flattered if they consider using mine, but i do not think they would touch the running system :D. Other projects have the option to use the older, more stable drawille.Canvas with text printing, or the fancy, new plottile.Canvas with colors 🎉 .

tldr: I will not split the project to keep it manageable for me.