red-data-tools / unicode_plot.rb

Plot your data by Unicode characters
MIT License
246 stars 12 forks source link

Anti-Aliasing #58

Closed obromios closed 3 years ago

obromios commented 3 years ago

First, thank you for a very useful utility.

Have you thought about anti-aliasing the plot. It may, in some circumstances, make the plots easier to interpret?

kojix2 commented 3 years ago

Let's try cool-retro-term! I really like this terminal emulator. Fantastic anti-aliasing.

image Joking aside, I don't think anti-aliasing is a issue that can be controlled by UnicodePlot. That's the job of the terminal emulator. Please find your favorite terminal emulator that allows anti-aliasing and set it up.

mrkn commented 3 years ago

@obromios What did you mean by "anti-aliasing" in this context? I couldn't imagine what the result you want because UnicodePlot just makes a plot result by filling Unicode characters while anti-aliasing is a technique for altering a bitmap image.

Could you describe it by illustrating both before and after outcomes if the "anti-aliasing" were supported?

obromios commented 3 years ago

@mrkn, anti-aliasing is a general term referring to correction of signals being reconstructed at too low a sampling rate. You are correct that in image processing, the most common way to do this is altering the bit map image. However, I was wondering whether anyone had done some thinking about this for this gem. In particular with the full unicode character set, you have characters like the spacing modifier letters, that might allow you to do some rough anti-aliasing. It may well be an up hill task, but I will put this on my list of things to think about.

mrkn commented 3 years ago

@obromios I'm interested in how to perform anti-aliasing with spacing modifier letters. UnicodePlot is designed for using monospace characters to build rectangle canvas to show in a terminal so I consider surrogate pairs etc. are not usable. I would like to see more detail example. Could you illustrate how to use such special letters?

By the way, if you want to get more higher resolution plots, you can specify a larger canvas size by passing width and height parameter like:

UnicodePlot.lineplot(x, y_sin, name: "sin(x)", width: 200, height: 50)
Screen Shot 2021-07-19 at 16 03 57