I'm trying to plot points as well as a non-linear fit function onto the same image. I used the command:

Show[ListLogLinearPlot[data, PlotStyle -> Red], 
 LogLinearPlot[myFit[x], {x, 0, 35000}], Frame -> True]

Where, data is my plot data (see red points), and myFit is the fit function (blue line). However, the blue line corresponding to the fit curve covers a smaller domain than the plotted points, which looks weird. I've tried playing with the values in the argument {x, 0, 35000}, but this seems to just shift the line along the fit curve but doesn't extend it. Is there any way that I can make the blue line extend from the first red plot point to the last?

illustration of the problem. Red dots = plot points, blue = fit curve

Update: Requested plot data, fit to a non-linear equation of the form a x Log(x) +b \sqrt{Log(x)} + c

13.7 , 3
13.8 , 3
11.5 , 3
84.8 , 13
98.7 , 18
95.9 , 19
716.1 , 75
525.0 , 100
209.6 , 40
3957.8, 200
2550.6 , 100
1160.2 , 175
9699.2 , 350
29004.1 , 900
11213.8 , 325
  • $\begingroup$ Try adding PlotRange -> All to LogLinearPlot. $\endgroup$
    – JimB
    Mar 10 at 2:38
  • $\begingroup$ Ah that helps! It extends to the right, but on the left it doesn't, stopping at 50. The fit function should be defined for all x >1. But honestly it already looks way better $\endgroup$ Mar 10 at 2:50
  • $\begingroup$ Welcome to the Mathematica Stack Exchange. Please load data, so that respondents can study the problem and offer help in a focused manner. $\endgroup$
    – Syed
    Mar 10 at 3:27
  • $\begingroup$ LogLinearPlot with {x,0,35000} that 0 worries me. Does {x,10,35000} along with PlotRange help at all? Is your myFit[x] also done from 10 to 35000? $\endgroup$
    – Bill
    Mar 10 at 3:39
  • $\begingroup$ Yes that actually completely fixes it! It was the combination of PlotRange and adjusting the numbers. If either of you JimB or Bill post the full solution I'll be happy to mark this resolved. Thanks a bunch $\endgroup$ Mar 10 at 3:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.