Basically, I donβt know how to build the line most suitable for my data when it will be a logarithmic scale. I put a linear regression line on my graph using lm () and abline (), but now that log = "xy" has been added, it just creates a horizontal line.

Here is a very simplified example of what I'm trying to do (the line is missing here):
lengths = c(10000,3000,3005,3005,3010,20000) counts = c(3,1,1,2,1,3) line=lm(counts~lengths) plot(lengths, counts, col="green", log="xy") abline(line, col="blue")
I tried a lot of things that I found on similar issues (e.g. using log10() and lines() ) and they did not work with my data.
r plot lm
Jessica b
source share