kaijagahm / ygdpDashboard

Interactive dashboard for YGDP survey data
3 stars 0 forks source link

Improve RGB mode #32

Open kaijagahm opened 3 years ago

kaijagahm commented 3 years ago

Added a pretty primitive version of [RGB mode] in https://github.com/kaijagahm/ygdpDashboard/commit/94d9ec13802d164af150bf195b53689a46c8e6a3.

I don't love this, though--I don't think it's a good way to display data. Problems:

Going to bring these suggestions for tweaks into a different issue.

Originally posted by @kaijagahm in https://github.com/kaijagahm/ygdpDashboard/issues/25#issuecomment-746828757

kaijagahm commented 3 years ago

A different idea that Jim and I had was to simply replace the three separate color legends with a single triangle legend, like this: Screen Shot 2020-12-23 at 14 48 32

(Note: the above image is a screenshot from https://observablehq.com/@toja/triangular-color-interpolation, which is a very useful website for computing color interpolations. Could definitely be helpful for the future, if we want to develop a not-horrible color triad.)

So basically, we were thinking I could just take a screenshot from that site, label the vertices "Sentence 1", "Sentence 2", an "Sentence 3", overlay that static image on the map instead of all of the legends, and call it good.

But... that's not good enough. Because we also have black and white going on, somehow. The sticking point is that I'm generating the colors through the rgb() function within R, and I don't actually understand the mechanics behind it. For example, take a look at this screenshot from an example with three "after perfect" sentences in interpolation mode: Screen Shot 2020-12-23 at 14 53 59

Some of the hexagons are almost white, and others are almost black! What's going on here?

I think the triangle actually isn't a proper representation of the colorspace. It's not clear to me how you'd get to the internal colors in the triangle. After all, the colors on the map are generated by manipulating the three components (R, G, and B) separately. If all of them are set to 255, then the color is white (so, by analogy, if all three sentences are rated 5 in a given hexagon, then that hexagon would be white). If all of them are set to 0 (i.e. if all three sentences are rated as 1), then that hexagon would be black. I don't actually think a triangle represents what's going on here. Maybe we need a triangular prism?? But no, even that doesn't seem right, because I still really don't understand how you would reach the center of the triangle.

Aha! I did some more googling, and it seems that the correct representation of the colorspace is as a cube. There's a good simulator for this here: https://programmingdesignsystems.com/color/color-models-and-color-spaces/index.html#:~:text=The%20RGB%20color%20model%20is,the%20bounds%20of%20the%20cube

Screen Shot 2020-12-23 at 15 10 25

That website allows you to input different colors and look at the results. If you put all sliders up to 100%, you get white; if you put them all down to 0%, you get black.

The problem is, of course, that this is probably not possible to display as a legend on a graph. Well, there you go. This explains why RGB is never really used for data viz like this.

kaijagahm commented 3 years ago

After discussion with Jim on 3/11 and 3/12, changed the max color to 130 out of 255 for each of R, G, and B. This makes the map a little more readable.

Made this change in commit https://github.com/kaijagahm/ygdpDashboard/commit/46ddb123f5618ae075e8d012fde8c20abc1a29fd

kaijagahm commented 3 years ago

This thesis talks a bit about GabMap's approach to using three colors on an MDS map (figure at the end refers to section 6.something.something, which describes a bit.

The main difference between their approach and ours seems to be that they plotted the results of an MDS analysis, whereas we're trying to plot just the raw IDW data. They did MDS and then IDW. Not sure what the difference is?

Measuring_Dialect_Pronunciation_Di_erenc.pdf