13 Replies Latest reply on Dec 1, 2015 9:15 PM by nur idayu sabri

    How to visualize wind direction on a compass rose display?




      I've been asked to produce a chart which look like a tough challenge.


      The idea is to visualize wind history in a compass rose display. The data would be simply an angle and wind speed. I don't have any mock-up data to provide right now but I'd gladly start generate some later on.


      This chart is kind of similar to the "Florence Nightingale's Area Charts" (see http://www.tableausoftware.com/about/blog/2012/11/top-5-visualizations-all-time-19810)


      I've found this example using the javascript library D3 : http://windhistory.com/station.html?CWST

      Besides the animation part, it looks like to what I've been asked to achieve.


      Do you think it would be possible in Tableau?

      What would you do to show similar data with an alternative view? Maybe, the best I can do is to find a more relevant chart.


      Thanks for you help and ideas.

        • 1. Re: How to visualize wind direction on a compass rose display?
          Robin Kennedy

          Hi Damien,


          Hmm, that is a tough challenge. If I had my Stephen Few hat on, I would start by asking whether area charts around a circular reference frame are really the best way to display your data etc etc but hey, if it's good enough for Florence Nightingale then it's good enough for me.


          Despite Andy Cotgreave saying in San Diego that it wasn't possible to recreate Flo's viz in Tableau (he recreated the other 4 in his presentation) I think you can... I've been meaning to prove it but haven't had the time. The solution is to use a polygon chart where you can define all the vertices and then overlay your data (wind speeds) on top.


          I have attached an example (not my work, can't recall where it came from) which might help kick you off in the right direction. Let us know how you get on!




          1 of 1 people found this helpful
          • 2. Re: How to visualize wind direction on a compass rose display?
            Shawn Wallwork

            Damien, this certainly is an interesting challenge. First let me say I am not normally a fan of circular visualizations (pie charts, gauges, etc.) but this one has a compelling reason for being circular, the compass rose metaphor. It works well. It's a good thing you mentioned the 'animation', I didn't notice the control at first. Anyway, let me suggest how I think you'll probably end up doing this:


            • You'll probably end up with 3 layers, a background image, a polygon layer and then a 'calm' circle on top
            • The background image is straight-forward. The mapping training video will get you started.
            • The polygon layer will be the tricky one, but the good news is the slices are all 10 degrees with only the length changing. It'll probably end up being easiest to make the end straight rather than curved, but maybe not.
            • The calm circle will most likely be created using a dual axis chart, but I haven't messed with custom polygons enough to know if that's going to cause more problems than it's worth. I'm also not sure 1% will always be the calm figure, so I'm wondering if that circle isn't going to get bigger and smaller.
            • The animation is fairly straight-forward, at least in desktop. You'll put the months pill on the page shelf. But I'm not sure how long each set of polygons will take to draw, so it's hard to tell if it will be as smooth as the original.
            • It's probably best to do this as 3 separate sheet for each element, and then collect them on a dashboard.


            It'll be some work, but I think it is doable. And I think it'll be some fun working it all out. Keep us posted, interesting project.



            • 3. Re: How to visualize wind direction on a compass rose display?

              Thanks for your quick answers.


              It will definitely get me started and I'll get in touch when I have some results.

              • 4. Re: How to visualize wind direction on a compass rose display?
                Jonathan Drummey

                A couple of points to add to what Shawn & Robin wrote:


                - Totally do-able in Tableau, if you're willing to take the time to get the calculations right. The first time I did this kind of thing I had to relearn some geometry and trigonometry.

                - Stick with drawing triangles, so you'll only need three points * 36 directions = 108 rows per circle per month.

                - For the calm circle, I'd suggest adding a single row to the data, then plotting that on a dual axis as a circle mark. Or you could make another polygon for the circle, but that would add 100 to 360 rows (depending on how smooth you wanted the circle's edges to be).

                - For these few marks, the animation will be really fast, but jumpy because Tableau doesn't make smooth transitions between positions.

                - The slowest part will probably be the load time before the viz appears as Tableau loads everything into memory. For maximal speed, do as much pre-calculating as possible and use an extract.

                - You probably know this already, there is no play button for the Pages Shelf on Tableau Public or Tableau Server.

                - If you wanted to get really fancy, you might be able to use a background map, do the circular grids as shape marks on a dual axis, then plot the triangles and circles on top of that.



                • 5. Re: How to visualize wind direction on a compass rose display?
                  Shawn Wallwork

                  What Jonathan & Robin said. So taking the workbook Robin posted [which I suspect is a Richard creation turned out to be an Andrew Ball creation] I did a bit of surgery (deconstruction then reconstruction) and I was able to get this far:


                  Compass Rose.png


                  (See attached). The biggest challenges you're going to face are scale and registration. (That outside circle is for registration purposes only. Once we get everything worked out we can turn it white, so it disappears.) You'll notice that not all the 'lengths' hit the kts. radius circles perfectly, but for now this was the best I could do. There are a few little 'fudges' and adjustments necessary to get things this close, and I suspect that our old enemy 'monitor aspect ratio' will rear it's ugly head with this viz, but let's see how far we can get.


                  The next step is to add the month animation, which is where I got stuck . It's going to need either a join or a custom SQL, which this 'graphics guy' is still trying to learn. I've included the workbook and an Excel file with a couple of unused worksheets (wind speeds by month and that sheet reshaped). I was sort of hoping one of our Forum Friends will point us in the right direction to either merge or join or whatever these sheets so we can get the animation working.


                  This was great fun to work on. Thanks for posting this Damien.




                  Message was edited by: Shawn Wallwork

                  1 of 1 people found this helpful
                  • 6. Re: How to visualize wind direction on a compass rose display?

                    That's more than I initially expected. I've some other important assigned tasks due on Monday, but I'll get back to you soon. I feel confident that I can adapt this method with my data. All your answers are going to save me a lot of time. Thank you.


                    About the animation, my first message was certainly misleading. I won't implement animation on that chart. The view is going to be published on Tableau Server and I don't think it would be that relevant anyway. At best, I will use a filter.

                    The data being on the secondary data sources from what I've seen, using a parameter might help (at least in Tableau 7).


                    The circle at the center is of the viz is indeed an additional element I might not include in the final chart. My purpose was not to reproduce this chart made with d3 but just to illustrate something close to what I need to achieve.


                    I'll try to get back to you with an overview of my result by next Tuesday. I'll have a look about the animation part just for the play. It would be unfair that you had all the fun from my issue


                    Thanks again.

                    • 7. Re: How to visualize wind direction on a compass rose display?
                      Robin Kennedy

                      Nice work, Shawn. I like it (altho I'd probably kill the different colours )


                      After a bit of asking around, the original workbook was actually created by m'colleague Andrew Ball

                      • 8. Re: How to visualize wind direction on a compass rose display?
                        Shawn Wallwork

                        Thank Andrew for this, it's a nice piece of work. So you don't like the color, huh? I suspect that's because I wasn't showing that it was actually a continuous color range:



                        Start getting towards the reds and Her Majesty's Coastguard will be issuing small-craft warnings.



                        • 9. Re: How to visualize wind direction on a compass rose display?



                          I didn't have much time to reply. I provide an example of animation based on Shawn's Wallwork's workbook. There is actually no real difficulty when you understand JOIN. There is no need for Custom SQL.


                          I would also like to precise that in my data, the wind direction (equivalent to the dimension "Degrees" in the previous workbook) was not a discrete dimension but a numeric (taking values such as 23.34, 304,34, 245,34, etc.). Data Blending being not possible on bins, I had to create a new dimension as follow:


                            1. IF [WindDirection]>= 0 and [WindDirection]< 10 THEN 10
                            2. ELSEIF [WindDirection]>= 10 and [WindDirection]< 20 THEN 20
                            3. ELSEIF [WindDirection]>= 20 and [WindDirection]< 30 THEN 30
                            4. ELSEIF [WindDirection]>= 30 and [WindDirection]< 40 THEN 40
                            5. ELSEIF [WindDirection]>= 40 and [WindDirection]< 50 THEN 50
                            6. ELSEIF [WindDirection]>= 50 and [WindDirection]< 60 THEN 60
                            7. ELSEIF [WindDirection]>= 60 and [WindDirection]< 70 THEN 70
                            8. ELSEIF [WindDirection]>= 70 and [WindDirection]< 80 THEN 80
                            9. ELSEIF [WindDirection]>= 80 and [WindDirection]< 90 THEN 90
                            10. ELSEIF [WindDirection]>= 90 and [WindDirection]< 100 THEN 100
                            11. ELSEIF [WindDirection]>= 100 and [WindDirection]< 110 THEN 110
                            12. ELSEIF [WindDirection]>= 110 and [WindDirection]< 120 THEN 120
                            13. ELSEIF [WindDirection]>= 120 and [WindDirection]< 130 THEN 130
                            14. ELSEIF [WindDirection]>= 130 and [WindDirection]< 140 THEN 140
                            15. ELSEIF [WindDirection]>= 140 and [WindDirection]< 150 THEN 150
                            16. ELSEIF [WindDirection]>= 150 and [WindDirection]< 160 THEN 160
                            17. ELSEIF [WindDirection]>= 160 and [WindDirection]< 170 THEN 170
                            18. ELSEIF [WindDirection]>= 170 and [WindDirection]< 180 THEN 180
                            19. ELSEIF [WindDirection]>= 180 and [WindDirection]< 190 THEN 190
                            20. ELSEIF [WindDirection]>= 190 and [WindDirection]< 200 THEN 200
                            21. ELSEIF [WindDirection]>= 200 and [WindDirection]< 210 THEN 210
                            22. ELSEIF [WindDirection]>= 210 and [WindDirection]< 220 THEN 220
                            23. ELSEIF [WindDirection]>= 220 and [WindDirection]< 230 THEN 230
                            24. ELSEIF [WindDirection]>= 230 and [WindDirection]< 240 THEN 240
                            25. ELSEIF [WindDirection]>= 240 and [WindDirection]< 250 THEN 250
                            26. ELSEIF [WindDirection]>= 250 and [WindDirection]< 260 THEN 260
                            27. ELSEIF [WindDirection]>= 260 and [WindDirection]< 270 THEN 270
                            28. ELSEIF [WindDirection]>= 270 and [WindDirection]< 280 THEN 280
                            29. ELSEIF [WindDirection]>= 280 and [WindDirection]< 290 THEN 290
                            30. ELSEIF [WindDirection]>= 290 and [WindDirection]< 300 THEN 300
                            31. ELSEIF [WindDirection]>= 300 and [WindDirection]< 310 THEN 310
                            32. ELSEIF [WindDirection]>= 310 and [WindDirection]< 320 THEN 320
                            33. ELSEIF [WindDirection]>= 320 and [WindDirection]< 330 THEN 330
                            34. ELSEIF [WindDirection]>= 330 and [WindDirection]< 340 THEN 340
                            35. ELSEIF [WindDirection]>= 340 and [WindDirection]< 350 THEN 350
                            36. ELSEIF [WindDirection]>= 350 and [WindDirection]<= 360 THEN 360
                            37. END

                          The formula might not be optimized and is quite repetitive but it works.

                          • 10. Re: How to visualize wind direction on a compass rose display?
                            Jonathan Drummey

                            Lovely! With some more annotation/information this could be a good viz for Tableau Public, I think. And I'm fascinated by why there are consistent outliers to the ENE and WSW.


                            Here's an alternate to the giant IF statement:


                            IF [Wind Direction] < 360 THEN INT([Wind Direction]/10)*10+10 ELSE 360 END



                            2 of 2 people found this helpful
                            • 11. Re: How to visualize wind direction on a compass rose display?

                              This is mock-up data, so we can't learn anything from this Viz. It would however be interesting to find a proper dataset with this kind of information (unfortunately, I can't publish mine). I'll have a look. I would like first to improve this Viz.


                              Thanks for the formula. It's that simple... I feel shameful I thought of the big one first


                              EDIT :

                              I'm just proposing a small change to the formula because my dataset has some missing values:

                              IF ISNULL([WindDirection])

                              THEN NULL

                              ELSEIF [WindDirection] < 360

                              THEN INT([WindDirection]/10)*10+10

                              ELSE 360


                              • 12. Re: How to visualize wind direction on a compass rose display?
                                Jonathan Drummey

                                You're welcome for the formula, I only learned that from some other folks after having made my own enormous IF/THEN statements.

                                • 13. Re: How to visualize wind direction on a compass rose display?
                                  nur idayu sabri

                                  Hi, i've tried to create this rose plot, but i have problems when it comes to use my own data of wind direction/degree. I don't know what went wrong. My data is a daily data.


                                  Okay now, i have the polygon info in one sheet and in another sheer i have wind direction and wind degree. I have follow exactly as the clock example, but the length of my rose plot has exceed the compass image.