
1. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Joshua Milligan Apr 18, 2015 5:35 AM (in response to Jonathan Drummey)This one was fairly easy. I'd give it a 2. (But there's always a little doubt in the back of my mind that there might be an even easier way!)
Joshua

2. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Simon Runc Apr 18, 2015 6:05 AM (in response to Jonathan Drummey)hi Jonathan,
Thanks for these.
I'd give this one a 2 also...though again will be interested to see your final solution to see if it's any easier than mine (and possibly more dynamic!)

3. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Yuriy Fal Apr 18, 2015 11:38 AM (in response to Jonathan Drummey)Hi Jonathan,
Thanks, too.
Give it 2.8 ;)
I'm curious about the very vivid colors of yours (mine being pale).

4. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Bill Lyons Apr 18, 2015 9:54 PM (in response to Jonathan Drummey)I guess I'm not as sharp as the rest of you. I give it a 4. It really had me stumped, and I cheated. The solution was easier than the path I was going down.

5. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Brittany Fong Apr 22, 2015 6:32 AM (in response to Jonathan Drummey)These are fun! I give this one a 2.5.
It had me stumped at first.

6. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
cory.tak.0 Apr 27, 2015 11:33 AM (in response to Jonathan Drummey)This was fun. I'll give it a 3. Thank you for doing this.

7. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Rawan Alsiekh Apr 28, 2015 7:18 AM (in response to Jonathan Drummey)I give it 5 (I had to cheat ), and this means that I have to work on my Tableau skills to figure such a solution out ..
Thanks Jonathan for the brain teaser..

8. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Wendy Zhou Apr 28, 2015 6:40 PM (in response to Jonathan Drummey)Had across to similar requests before, fairly easy. I'll go with 1.9
Thanks for teasing every Tableau Geeks.

9. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Jonathan Drummey May 2, 2015 10:22 AM (in response to Jonathan Drummey)A solution:
Use dualaxes. Tableau only lets us have a single box plot reference line for each axis (the axis being generated by a continuous pill on Rows or Columns) with a single color scheme for that box plot, so to get multiple different colors for the box plots we use multiple axes and then join them in a multiple axis. In order to prevent values being duplicated on each axis, I created a measure for each box plot using a record level calc like SUM(IF [Department] == "Furniture" THEN SUM([Sales]) END) and used those in a dualaxis chart:
The box plot colors were created using Tableau's box plot colors:
And then I chose a color palette for the marks to reflect the available box plot colors.
Alternative Solutions
There are at least a few of other potential solutions to this:
1) Create a worksheet for each distinct discrete value then put them all in a dashboard, turning off Show Headers for the Y axis for all but the leftmost worksheet.
2) Build 5 calculations for each distinct discrete value (whisker ends, 25/50/75th %iles) that only return nonNull values for that discrete, then put them all on the LOD and build reference bands & lines using the BYO pre8.0 box plot technique.
3) Add 20 records to the data source for each distinct discrete value and then use those marks to draw the box plots as polygons on a dual axis. Given some work in the data source to automatically add those records and a ton of calculations, this is the only solution that I can think of that would be able to draw an arbitrary number of individually colored box plots.
Thanks for participating!

colored box plots end.twbx 1,009.1 KB


10. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Bryant Howell Feb 25, 2016 6:08 AM (in response to Jonathan Drummey)Jonathan,
I think I've come up with a solution that works to do distinct colors for any number of box plots.
1) Add the regular grey box plots from the reference lines
2) Create the following calculations to find your Upper and Lower Quartiles
Upper Quartile: WINDOW_PERCENTILE(SUM([Sales]), .75)
Lower Quartile: WINDOW_PERCENTILE(SUM([Sales]), .25)
3) Create a third calculation, Distance Between Quartiles
[Upper Quartile][Lower Quartile]
4) Bring the Lower Quartile calculation onto the Rows Shelf. Set Mark type to Gantt Bar. Set the secondary axis to
using DualAxis, and synchronize the axes. Now you should have a Gantt bar at the same place at the lower quartile mark of the box plot. You may need to adjust the Table Calc runs for it to calculate correctly
5) Bring the Distance Between Quartiles calculation onto the Size of the Gantt marks card. This should make the Gantt bar go the full length of the box. Expand the size so it matches the width exactly.
6) Finally bring whatever is on the Columns shelf onto the Color of the Gantt marks. Now each box plot is colored distinctly.
7) Push the Gantt bars to the back using Move Marks  Tableau Software and hide the secondary axis.

box plots of any color.twbx 1.1 MB


11. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Yuriy Fal Feb 25, 2016 6:33 AM (in response to Bryant Howell)Hi Bryant,
My answer was the same as yours.
Definitely there is at least one more way
to get to the (almost) same result in Tableau.
Yours,
Yuri

colored box plots_YF.twbx 982.9 KB


12. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Jonathan Drummey Feb 26, 2016 5:58 AM (in response to Bryant Howell)Nice! I like the combination of the original box plot to get the layout
with the Gantt bars to get the coloring.
Jonathan
On Thu, Feb 25, 2016 at 9:07 AM, Bryant Howell <tableaucommunity@tableau.com

13. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Harish Krishnan Oct 24, 2017 10:20 AM (in response to Jonathan Drummey)Hi Jonathan,
I have a comparison whisker plot for two different groups on a dashboard and I have a dynamic median line belonging to each of the groups going over them ( Created by using dual axis). Can you please let me know on how to color the boxes without using a dual axis, I saw your solution and it doesn't seem to work on mine.
Any help would be greatly appreciated.
Thanks,
Harish Krishnan

14. Re: Educational Brain Teaser: Coloring the Boxes on Box and Whisker Plots
Jennifer VonHagel Nov 29, 2018 10:44 AM (in response to Yuriy Fal)Yuriy, this is brilliant, thank you!