ggdist icon indicating copy to clipboard operation
ggdist copied to clipboard

Coloring interval lines & point according to variable

Open mike-lawrence opened this issue 1 year ago • 1 comments

I'm using ggdist::stat_eye, but I'd like to color the individual linerange geoms as mapped to a data variable. Specifically, when visualizing MCMC outputs, I'd like to color the tail interval as mapped to whether ess_tail<100 and the bulk interval as mapped to whether ess_bulk<100, and finally the point as mapped to whether rhat>1.01, all with black-vs-red. Is this easily achieved if I have columns ess_tail<100/ess_bulk<100/rhat>1.01 in the data?

mike-lawrence avatar Sep 23 '24 15:09 mike-lawrence

After some digging, I see that there seems to already be three "classes" of things with a color attribute (slab, interval, and point), in which case, if it's easier, I could see mapping the interval color to ess_tail<100, point color to ess_bulk<100, and slab color to rhat>1.01 would work (with the slab colors being transparent for rhat<1.01, and red for rhat>1.01).

mike-lawrence avatar Sep 23 '24 17:09 mike-lawrence

If I understand what you're asking, that sounds about right for how to do what you want --- compute the relevant columns then map them to the sub-geometry colors. Let me know if you tried it and something didn't work as expected!

mjskay avatar Nov 21 '24 05:11 mjskay