2 Replies Latest reply on Nov 21, 2012 12:24 PM by Patrick Lefler

    How do I create and plot a line function within a scatter plot?

    Patrick Lefler

      New Tableau 7.0 user. I have a simple scatter plot with a Tableau created (black) Trend Line. I want to now create and plot two additional lines that are both functions of the Trend Line.

       

      The Trend Line equation: Cost = 9158 + (.0903 * Volume)

      The two line functions I'd like to create are percentages of the calculated Trend Line:

      Cost1 = 1.05* (9158 + (.0903 * Volume))

      Cost2 = .95* (9158 + (.0903 * Volume))

       

      Question: Can this be done in Tableau? How can I manually create these two equations (Cost1 & Cost2) and then plot them on the existing scatter plot.

       

      Packaged file attached (I hope I did it correctly). See desired image below. Many thanks in advance.

       

      Pat

       

      Scatter_HighLowLines.png

        • 1. Re: How do I create and plot a line function within a scatter plot?
          Catherine Rivier

          Hi,

          You actually have it almost complete.

          Create 2 new variables, exactly as you have them:

           

          Cost1:  

          1.05* (9158 + (.0903 * [Volume]))

          Cost2:   

          .95* (9158 + (.0903 * [Volume]))

           

          Then to display on the graph, put them on the dual axis.  (Easiest method, ctrl-select both fields, drag to the right axis, drop when you see a plus sign.  You can also pull them onto the Rows tab and select Dual Axis.)

           

          Then synchronize the vertical axes: right click on the right axis, hit Edit Axis, and check "Sychronize Dual Axes".

           

          Now the trickier part:  It will still have symbols on the line because of the primary axis settings.  To remove, under the Marks page menu (down arrow in upper-right corner of that page), select Multiple Mark Types.  This allows you to define the primary and secondary axis differently.  Select mark Measure Values, and this is where you change the appearance of these new trend lines.  Now what you want to do is only show the trend line, and not the values (because you only have values when you had volume).  There are several ways to do this, but what I'd do is make the symbols 100% transparent.  Pull down the drop-down box in the Color pill, and pull the Transparency tab to 0%.  Now all you see are those trend lines, and it should be good to go.

           

          Hope this helps, let me know if you have any questions!

          • 2. Re: How do I create and plot a line function within a scatter plot?
            Patrick Lefler

            Perfect! Thanks for taking the time to help - much appreciated!!

             

            Pat