annacrombie / plot

plot on the command line
MIT License
113 stars 9 forks source link

Is it possible to have a custom width stretch and shrink on the x axis (like height) instead of acting as a delimiter? #26

Open vbondzio opened 2 years ago

vbondzio commented 2 years ago

I.e. if I have 20 data points, the plot is 20 characters max in width and increasing that does nothing to the graph, decreasing just limits the maximum amount of rendered characters. Whereas de/increasing height stretches and compress on the Y-Axis, why the difference and would it be possible to have width behave the same as heights?

P.S. I looked at plot_fill_canvas and answered part of my question, there is no easy way, at least not for me :-) I think it would be nice to have ratio work on both axis if you ever get around to it. For now I'll figure out how I can "pad" my data to get at least terminal wide graphs.

annacrombie commented 2 years ago

This would be possible, but it would require a minor overhaul. The difference is mainly in what I originally designed plot designed for, which was to display as many datapoints as could fit on the screen for hourly weather data.

If I implemented this, I'm guessing it would be activated by -d :auto to maintain backwards compatibility.

vbondzio commented 2 years ago

If you feel it would be worth your time, I thinks it's a great feature, but I'm biased :-D

Maybe appending a letter to the width, e.g. s for stretch / shrink would be easier and maybe a for auto if you want to detect the terminal width? But hey, the actual ux of the argument isn't too important. Thanks for the consideration!

annacrombie commented 2 years ago

An update on this issue. The problem is more difficult than I previously thought, since it requires resampling the data. I probably won't have time to look at it for awhile, but implementing this is on my todo list :).