7 Replies Latest reply on Mar 16, 2018 6:22 AM by umesh rajashekar

    Overlaying a path onto a scatter plot

    umesh rajashekar

      Hello,

         I have a dataset with the scores of students in two courses (Physics, Math) and three different exams. My goal is to create a scatter plot of the Physics vs Math scores in Exam0 for all the students. I would then like to add a path that shows the score of a single student across the three Exams as shown below.

      Specifications:

      1. Exam0 scores of Physics vs Math for all subjects as big gray circles
      2. Give a subject, draw a path indicating subject's score across the three exams
      3. The path should be connected in the order of the Exam number
      4. The dots indicating the individual subject's scores are colored by the Exam number

       

      My attempt:

         I have attached a packaged notebook showing my attempts. Due to the constraints of the 'dual-axis', I have been able to generate either the path without the colored dots or the colored dots without the path, but not both on the same view.

       

      If you have any suggestions, kindly let me know. I'm also curious to know if there is a way to avoid so many "computed fields".

       

      thanks,

      Umesh

        • 1. Re: Overlaying a path onto a scatter plot
          Simon Runc

          hi Emesh,

           

          Let me know if the attached does the job, and I'll (try!) to explain how I did it. There are a couple of tricks in here!

           

          If it fails, let me know where.

           

          btw the Subject of interest is selected via the Drop Down Parameter.

          2 of 2 people found this helpful
          • 2. Re: Overlaying a path onto a scatter plot
            umesh rajashekar

            Hello Simon Runc,

              Thank you so much for taking the time to answer my question.Wow! That is a deviously ingenious solution! You solution is works great. I believe I understand all the steps - creating the "Maths (Excluded Subject)" computation lets you use it for both the charts without multiple dual-axis. Also, hats off to your effort for creating the black dot for Exam0 for the path using "Selected Subject- Label".

             

              I just noticed one issue of a tiny dot that appears (example attached below) at different locations depending on the "Selected Subject". It looks like it is associated with the plotting the Path. Otherwise the solution is perfect!

             

             

            Thanks,

            Umesh

            • 3. Re: Overlaying a path onto a scatter plot
              umesh rajashekar

              In order to get rid of the spurious point, I changed the computation for the pill corresponding to the path from

               

              SUM([Maths (Excluded Subject)])

              to

              IF [Subject]=[Selected Subject] THEN ([Maths (Excluded Subject)]) ELSE NULL END

               

              I've updated the worksheet. Full credit and thanks to Simon Runc for solving this problem.

               

              Thanks,

              Umesh

               

              P.S. I wish overlays were easier in Tableau. Currently it works well with dual axis, but only for overlaying two plots.

              • 4. Re: Overlaying a path onto a scatter plot
                umesh rajashekar

                Alternatively, a cleaner solution to get rid of the spurious dot might be to make a calculated field for either Math or Physics scores for the selected subject and use that for the line. Sheet4 in attached packaged notebook shows this solution.

                1 of 1 people found this helpful
                • 5. Re: Overlaying a path onto a scatter plot
                  Simon Runc

                  glad you liked the solution...it was a really fun puzzle! I might (if I find the time) post this up as an "Educational Brain Teaser" for the Community to have some fun!

                   

                  Impressed that you managed to unpick it all too! So the key to understanding how Tableau thinks, is that it's all about the Level of Detail of the Viz (you'll notice I aggregated the Maths and Physics, rather than use as dimensions, and then used the Detail Shelf to control the number of marks). This also has the nice feature that you could easily (if you changed the aggregation to AVG) look at this at higher level (say class) and then drill into the students.

                   

                  I thought I'd deal with that erroneous mark! Like you're solution. Another way I thought of was to create this formula

                  [Selected Subject - Hide Extra Mark]

                  IF [Subject] = [Parameters].[Selected Subject] THEN 1 ELSE 0 END

                   

                  Bring it onto colour and set the 0 to White (attached)

                   

                  with regards having more than 2 layers, yes it can be a restriction, but the general method is to re-shape the data so it goes down the page, and then use the levels created to create the layers. For example if you just had a single column called "Result", and then had a dimension for "Study Subject" which would be Maths, Physics...etc. you can then use this field to create layers for multiple subjects (by adding to colour, say) but for 2D scatter plots, your current shape is the easiest.

                   

                  Fun question though!

                  1 of 1 people found this helpful
                  • 7. Re: Overlaying a path onto a scatter plot
                    umesh rajashekar

                    Hi Simon Runc,

                      Thank you so much for taking the time to address the spurious dot. I like your solution better than my hacks. I have updated the 'Correct Answer' to your latest post. Thank you very much for your explanation of the advantages of 'long' data formats in Tableau.

                     

                      Also, I appreciate you taking the time to post this question as an 'Educational Brain Teaser'; I'm curious to see how others solve this problem.

                     

                    thanks again!

                    Umesh