7 Replies Latest reply on Jan 28, 2019 11:00 AM by Fallyn Thompson

    12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis

    Fallyn Thompson

      Hi Everyone,

      I'm trying to make 1 global map divided into 12 world regions, where each region has a unique sequential color palette. I've managed to get 2 regions using 2 sequential color palettes on 1 map, however, I can't figure out how to have more than two/ past using a dual axis. Is this possible in Tableau?? It seems like it should be simple to have multiple sequential colored categories...Any help is greatly appreciated!!

      Jonathan Drummey

        • 2. Re: 12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis
          Fallyn Thompson

          Thanks for reviewing this for me! The last tab "6 maps (12 sequential)" is the one I'm working with. However, the tab "12 individual sequential maps" is the same thing without joining the marks using the dual axis. I'm not sure which tab is easier to work with/ how to move forward...

          Ken Flerlage

          • 3. Re: 12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis
            Fallyn Thompson

            I also included the first tab "Not "True" Colors" because the data source is the same information but it's arranged differently if it helps.

            • 4. Re: 12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis
              Ken Flerlage

              So, one option for Not True Colors would be to use the option documented here: Create Dual-Axis (Layered) Maps in Tableau - Tableau. But it looks like you're already doing something like that. If you were to create a custom continuous palette that goes from white to black, then it won't mess with the color of the discrete axis as much.


              Another option would be to remove the second axis, then drag SUM(Country Projects) to the detail card, change it to a dimension (it doesn't look like you need to aggregate), change it to discrete, sort it descending, then click on the icon to the left of it to change it to color.

              You can have multiple discrete fields on color, but can't have multiple continuous and can't mix discrete and continuous.


              Tableau will now automatically attempt to assign different continuous palettes to each region based on the country projects value.

              They are still discrete colors, but Tableau's done some of the work for you.

              The flaw in this technique is that you don't have a lot of values so, where 54 may be the darkest blue for Caribbean, the darkest purple for Southeastern Asia is the value 10. So that could prove to be somewhat problematic. That is the advantage of the earlier approach documented on the Tableau blog.

              1 of 1 people found this helpful
              • 5. Re: 12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis
                Jonathan Drummey

                Hi Fallyn,


                You can do this using the #2 method from http://drawingwithnumbers.artisart.org/two-sequential-color-palettes-on-the-same-map/. You’ll need:


                - A Tableau custom color palette with all the colors set up. Here’s an example one I used in a recent project. Note that the first value in each hue repeats to provide a ‘reset’ color for that palette. The all white palette in the first hue is one that we added so we could show non-reporting districts (i.e. districts that a had a Null value for the measure) as white rather than as the bottom level of the color.



                     <color-palette name="PMI VectorLink Heatmap" type="ordered-diverging">


                  <color>#FFFFFF</color> <!-- White -->

                  <color>#FFFFFF</color> <!-- White -->








                            <color>#c8c8c8</color> <!-- blues -->

                            <color>#c8c8c8</color> <!-- blues -->








                            <color>#c8c8c8</color> <!-- reds -->

                            <color>#c8c8c8</color> <!-- reds -->








                            <color>#c8c8c8</color> <!-- greens -->

                            <color>#c8c8c8</color> <!-- greens -->








                            <color>#c8c8c8</color> <!-- browns orange -->

                            <color>#c8c8c8</color> <!-- browns orange -->









                - The measure for the color, in the formula below it’s [Value]


                - A dimension in your data to indicate the desired color ramp. In the formula below it’s a number from 1-4 in the [Variable Color Factor] field, where each [Variable] has an assigned color factor. This is an example of “very tall” data where we’ve taken what would ordinarily be separate columns in the data for Malaria Incidence, Vector Density, Population, etc. and transposed/pivoted/unpivoted the data such that each value is a row with a [Variable] and a [Value] and a [Variable Color Factor].


                - Calculations to get the min & max values in the desired context. In our case we used Level of Detail (LOD) expressions to compute the Min & Max across the currently displayed data for each variable, here’s the Max formula:



                {INCLUDE [Variable] : MAX(


                  {EXCLUDE [Period], [Month], [Transmission Year], [Transmission Year (full)],

                  [Province], [District], [Org Unit Name Level 3], [Org Unit ID]: MAX([Value])})}


                We’re using INCLUDE & EXCLUDE rather than FIXED so the calculations are responsive to regular dimension filters, and using LOD expressions instead of table calculations to avoid the extra complexity of table calculations.


                - A Color calculation to interpolate the values and appropriately assign them within the color ramp. To make life simpler in this case I thought of the color ramp as having 7 values (the 7 sub-hues in each hue) and then we have the 5 hues.


                IF ISNULL([Value]) THEN

                  1 //if non-reporting i.e. Null then assign to the white color ramp


                //scale numbers to a 1-7 range

                ((([Value] - [Min Value]) / ([Max Value]-[Min Value]) ) * 6 + 1)


                //assign to the appropriate hue


                +  ([Variable Color Factor]) * 7 + [Variable Color Factor]



                - The calculated field goes on Color and uses the Advanced tab to fix the range of colors used, in our case based on the colors we use a range from 1-40.


                With all of this set up each view then needs:


                1) Either a filter for a specific Variable or Variable Color Factor and/or the Variable or Variable Color Factor dimension(s) in the view.

                2) The custom configuration of the color palette.




                PS: I saw Ken's answers in this thread and the post I linked to above talks about potential issues with both of those methods. Specifically using a discrete pill has problems if the data doesn't have all of the discrete values available when the viz is created and then the data later changes (#4 in the post), and using the white/black on color on a dual axis creates a really muted palette (#3 in the post).


                PPS: There's the deeper question of whether doing all this work is at all useful. In use case that I was working with we're using this to generate views where we have several distinct maps in a trellis layout where each has its own distinct color ramp. Putting all color ramps in one single map could easily lead to confusion.

                2 of 2 people found this helpful
                • 6. Re: 12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis
                  Ken Flerlage

                  Oh wow, great answer Jonathan! I actually have a blog ready to post on this topic, but I didn't realize you had already written it!! Thanks!

                  • 7. Re: 12 Sequential Color Categories on 1 Global Map - Beyond Dual Axis
                    Fallyn Thompson

                    Thank-you both so much for your help! Jonathan Drummey I'll have to spend some more time going through the second method in your packaged workbook to try and duplicate this. I'll do my best not to ask too many questions as I'm going through it. One quick question - is there a blog post anywhere about how to set up the color legend once you're finished? Or do you just assign the closest discrete color mark?


                    Also, Thank-you Ken Flerlage for the advice to change the sequential color from white to black. This will really help in the interim while I'm trying to complete the custom color palettes above!


                    I'll update the post with my completed packaged workbook once I'm done for anyone else trying to do something similar.