hrbrmstr / statebins

Alternative to choropleths of US States ala http://bit.ly/statebins
Other
124 stars 28 forks source link

Displaying multiple variables in a single bin #12

Open ciflikli opened 6 years ago

ciflikli commented 6 years ago

Background: I'm working on a shiny app that visualises US House and Senate voting patterns (with two types of scores, so four combinations). Currently I use the highcharter package however I want to switch to statebins - it looks really neat! Highcharter also takes forever to load every time a setting is changed - I'm hoping statebins would be faster (although not yet tested).

Request: Would it be possible to show more than one variable value in a single bin (w/o using faceting)? I really like the new facet functionality, but I also don't want to display 2x2 US maps to the user on a single page. I couldn't really find a working example (which might be telling), so I am attaching some hastily done photoshop'd possibilities:

bars number two_colurs

Not sure about the feasibility of any of these, but looking forward to your response! Cheers.

/Gokhan

hrbrmstr commented 6 years ago

This is a neat idea!

Started pondering potential solutions. I fear they all might be slow-ish but I won't know until I try a few out. The "WI 52" one is the most easily doable but I'll see what might make sense for the others.

For the "WI Blue/Red", wld that always be half/half? That might be not-too-hard to do either if so.

ciflikli commented 6 years ago

Thanks for looking into it!

To me, from a design point of view (i.e. not considering the programming aspect), the "WI Blue/Red" solution would be ideal assuming the implementation is something like: pass two fill/variable arguments, split the bins into halves (either vertical/diagonal; always the same), then fill the respective halves with the values. So the blue part of WI can display Democrat scores and the red Republicans. The intensity of colours can indicate the effect: say, darker colours indicate higher values - I'm trying to think of a way w/o resorting to a double-legend.

I assumed "WI 52" solution would be the easier one to implement, however I suspect it may not be very intuitive for some users. With that said, I'll take any enhancement that accomplishes the task!

hrbrmstr commented 6 years ago

Just a quick note to say that progress has been made

image

Each one of those is a geom_oscar() (coming from the latin alphabet position of the nautical flag it looks like "O" or "Oscar" in clearspeak). I just made a random tester for it first.

Still much work to do, but it's all downhill from here. Well kinda. Making it rounded it going to be "fun" but we'll see how that goes. I need to add more polygons for the border spacing as well. But, progress is progress!

ciflikli commented 6 years ago

Looks very promising! Happy to give it a go once it's out.

mkiang commented 6 years ago

Late to the party, but I'm working on a similar issue. If you have only two variables with relatively few categories (~3), statebins works great with a bivariate color ramp. Something similar to this suggestion by Brewer. Hoping to have a public version ready to share in about a week as an example.