Forum Discussion
Scatterplot trend line does not go through data
I am adding a trend line to a scatterplot. As you can see in the attached screen shot, the line does not go through the data. I cannot figure out what is going on here. In fact, two of my colleagues have looked at this and we're all stumped.
Things we've tried:
- Turning off all filters and slicers
- Filtering out blank values
- Filtering out values beyond the visible axes
- Turning off all axis limits (i.e., there is no data beyond the visible axes that could be pulling the line)
The line does respond to changes in filters: if we turn filters/slicers on and off, the line will shift, but it never actually goes through the displayed data.
Are there any other things that we should look at?
Edit/Update:
The y-axis is on a log scale. If I change the scale to linear, the line works properly. So, This appears to be a bug. When the y-axis is changed to log, the trend line continues to be on a linear scale. Is there any way to fix this?
Screen shot of y-axis on a linear scale (same data) added for comparison.
Log scale:
Linear scale:
5 Replies
- AnonymousNot applicable
Hi dtan ,
Can you please share some sample data for test? It is hard to test without any sample data.
How to Get Your Question Answered Quickly
Notice: please do mask on sensitive data before share
Regards,
Xiaoxin Sheng
- dtanRegular Visitor
Sure. Here is a table of log-linear data that I created with python:
x y 1 1000 2 784.76 3 615.8482 4 483.293 5 379.269 6 297.6351 7 233.5721 8 183.2981 9 143.845 10 112.8838 11 88.58668 12 69.51928 13 54.55595 14 42.81332 15 33.59818 16 26.36651 17 20.69138 18 16.23777 19 12.74275 20 10 When I plot this in PowerBI with y on a linear scale, the trend line is correct. When I plot with y on a log scale, the trend line no longer goes through the data.
Linear scale:
Log scale:
The data were created so that the relationship is perfectly log-linear, and the line should go exactly through the datapoints. Here is a plot I made with the data in python with the y data plotted as log10(y):
- AnonymousNot applicable
Hi dtan ,
I can reproduce your scenario.
I build a table from your sample data and add a calculated column based y column, trend line works well as the result that your python code generated.logY = LOG10([y])
Regards,
Xiaoxin Sheng
- AnonymousNot applicable
Hi! I'm facing the exactly same issue here. Is there any workaround except creating a custom visual by myself?