6 Replies Latest reply on Nov 18, 2014 6:07 PM by Yosuke Horiuchi

# How to draw a reference line with formula

I would like to draw a reference line showing "y=1/x" line in scatter chart.

Does anyone know how to draw this line?

Is it possible to draw this line with formula?

• ###### 1. Re: How to draw a reference line with formula

Yosuke:

Not knowing your data, its a little hard to see what you want to achieve, but it is possible what you are looking for. It will not be the reference line, but you can get this by drawing a line.

Once you have the scatter plot, create a calculated field with what you are looking for and drag that to your row shelf and make it a line type.

Ex. For example, I used % of sales and % of order quantity on column and row shelf. Created another calc field = 1/calc2.

Hope this helps..

..kk

• ###### 2. Re: How to draw a reference line with formula

Dear Karunaker

I tried the way you showed me, but there is one issue that a line is not accurate when the graph shows only few plots.

Is there any solution to draw accurate line even when only few plots are shown in graph?

Thank you...

• ###### 3. Re: How to draw a reference line with formula

Yosuke:

Can you elaborate on what you mean by "not accurate". Attach your workbook even with some sample data and also what are you looking for a desired output.

..kk

• ###### 4. Re: How to draw a reference line with formula

Dear Karunaker

I would like to draw "y=1/x" line in literally.

However, in below case, reference line is angular because number of the plot shown on graph are only 4 plots,

even though "y=1/x" line should be rounded ideally, not angular.

(It means the number of plots is not enough to draw "y=1/x" line.)

And a sample case of using "y=1/x" line is as below.

Sales = Qty * Price

x axis->Growth of Qty from last year

y axis->Growth of Price from last year

In above case, reference line will be a border between "positive growth of sales" and "negative growth of sales".

(Sales growth = Growth of Qty * Growth of Price)

If possible, please teach me how to draw "y=1/x" line in literally.

Thank you.

• ###### 5. Re: How to draw a reference line with formula

Yosuke:

Due to the limited data, we are seeing angular lines and not curved (if thats what you mean literally). Don't know if there is an any easy way to do this in Tableau other than data densification and create additional points to look like a curved line.

Is there any reason you want it curved, in my opinion, as curved lines does not provide any additional value and sometime it misrepresents the data when compared to the straight lines expect they look smooth.

Check these posts;

http://vizwiz.blogspot.com/2011/12/when-you-use-smoothed-line-chart-your.html

smoothing out the line graphs

In Tableau, curved lines are used for trend lines and one way you can use is to plot those marks and create trend line with Logarithmic or Exponential Model type. Hope this helps.

..kk

• ###### 6. Re: How to draw a reference line with formula

Dear Karunaker

Thanks to your information, I understood curved line sometimes causes misunderstanding.

For this time, however, I would like to draw "y=1/x" line just as reference to enhance user's understanding.

If you have any other idea, please share with me.

Adding new plots for drawing trend line is a little difficult because the graph format is broken when I add new plots.

Anyway, thank you very much for answering my question.

Thank you.