sunetos / TextPlots.jl

Fancy terminal plotting for Julia using Braille characters.
MIT License
45 stars 11 forks source link

color text plots #6

Open hayd opened 10 years ago

hayd commented 10 years ago

It'd be great to be able to plot with color. e.g. each plotted function having a different color.

sunetos commented 10 years ago

Having each plot be a different color might not be too hard, but choosing the colors could be pretty difficult. I think most people have a color scheme in their terminals that makes it impossible for a terminal app to actually specify "red," unless I'm misunderstanding. Would it be ok to just have different colors without being able to specify what those colors are?

mlhetland commented 10 years ago

The main application for me, here, would just be to see which dots belong to which curve. So I'd be happy with automatically chosen arbitrary colors (though possbly configurable, in case one of them happens to be my background color, or the like). There should be a legend too, though, or we could just identify which dots belong to which curve—but not which curve represents which function/array… (And then we'll need labels for the legend. Hm. Starting to smell bloat-y, maybe? Or maybe not.)

sunetos commented 10 years ago

‎I thought about this some more, and I don't think it's possible. The braille character hack sets dots in a grid, so when two plots intersect, they share the same character in the terminal. Since a rendered character can't have more than one color at once, I'm not sure how this be pulled off.

a d a m From: Magnus Lie Hetland Sent: Sunday, September 14, 2014 3:15 PM To: sunetos/TextPlots.jl Reply To: sunetos/TextPlots.jl Cc: Adam R. Smith Subject: Re: [TextPlots.jl] color text plots (#6)

The main application for me, here, would just be to see which dots belong to which curve. So I'd be happy with automatically chosen arbitrary colors (though possbly configurable, in case one of them happens to be my background color, or the like). There should be a legend too, though, or we could just identify which dots belong to which curve—but not which curve represents which function/array… (And then we'll need labels for the legend. Hm. Starting to smell bloat-y, maybe? Or maybe not.)


Reply to this email directly or view it on GitHub: https://github.com/sunetos/TextPlots.jl/issues/6#issuecomment-55535999

mlhetland commented 10 years ago

Oh, right, of course! You'd have to have a single Braille character in multicolor ;-) Oh, well. (I guess it could work in ASCIIPlots, tho.)

sunetos commented 10 years ago

‎It might be entertaining to experiment with it; chars with a single color would be that color, and chars with multiple colors could try blending them to an average color? I have no idea if that could work.

From: Magnus Lie Hetland Sent: Sunday, September 14, 2014 3:24 PM To: sunetos/TextPlots.jl Reply To: sunetos/TextPlots.jl Cc: Adam R. Smith Subject: Re: [TextPlots.jl] color text plots (#6)

Oh, right, of course! You'd have to have a single Braille character in multicolor ;-) Oh, well. (I guess it could work in ASCIIPlots, tho.)


Reply to this email directly or view it on GitHub: https://github.com/sunetos/TextPlots.jl/issues/6#issuecomment-55536314

mlhetland commented 10 years ago

Was writing this when you suggested the blending/average. Sounds like an interesting idea! Though one would need to chose the colors carefully, then, guess. Maybe grayscale, even?

My original message:

One (not-quite-ideal) solution might be to have a z-ordering, and let the curve on top decide which color the intersection character should have. I guess it would look like a bit of "color contamination" on the other curve. Or the intersections could be black, or the like. Not aesthetically optimal, but would still permit one to tell where the different curves are, in general. (Another option would be to have different dot spacing – buuut I guess you'd lose resolution pretty quick ;-))

mlhetland commented 10 years ago

Just handling two colors would be quite useful, I think – comparing two curves gives you quite another piece of functionality beyond just the movement of a single one. Then one could have black and light-ish grey, and the intersection could be dark-ish gray?

mlhetland commented 10 years ago

Or … could one use some Unicode magic to make the characters from the two curves overlap? (There are lots of special codes for overlap and negative spaces, etc.)

sunetos commented 10 years ago

Ooh, interesting! Since unicode hacks are what this project is about, I'm definitely going to look into that. If I find anything in the next day or two, I'll post a screenshot of the progress. Please let me know if you find any good examples of similar hacks!

mlhetland commented 10 years ago

Cool! Well, it seems I may have been wrong about negative space. (Changing writing direction, though? Might that work?) There are quite a few combining characters, but not sure if you could force Braille characters to overlap… But, yeah, it would be really cool if it could be done!

sunetos commented 10 years ago

So far the closest I've found is the combining dot characters (http://graphemica.com/search?q=combining+dot), but so far I can't seem to reliably build a grid out of them like with the braille characters. I might try the color averaging next.