I want to add a 45-degree line on my plot. I tried some ways (including refline) all give me a 38-degree line!
302 views (last 30 days)
I wanted to have a 45-degree reference line on my plot. I searched and found there is a function namely refline so I use it but as you can see here it renders me a 38-degree line:
I even used
but another problem appears. I mean although the line converted to 45 degrees but some space appears on my graph that is not good:
Here is the code that I used:
MONTHLY = scatter(X, Y)
As a result, I want something like a black line this graph:
In order to compare trendline (red line) with the perfect condition (45-degree black line).
I attach my X and Y.
Thank you so much
More Answers (2)
Kouadio Guillaume N'DRI on 22 Jan 2022
Edited: Walter Roberson on 23 Jan 2022
In case someone still struggling with this. Find below my suggestion. I had the same problem with the refline.
axis([0 max(max(x1),max(x2)) 0 max(max(x1),max(x2))])
plot([0 max(max(x1),max(x2))], [0 max(max(x1),max(x2))])