0
$\begingroup$

I certainly do not use the Plot feature in Mathematica in its whole glory, but it worked out for me, except for one problem. I wanted to show some plots in a log-log-manner and it just won't show the red plot properly, its function beeing $f(t)=(1-\frac{1}{2}t^2)^2$. I just wanted to plot it until its minimum, however it cuts when plotting it. Extending the plotrange to 5 gives me some part 'suddenly appearing' afterwards but it wont go down to 0.01 in both cases

Red function doesn't go down

$\endgroup$
  • 2
    $\begingroup$ Could you please provide your code? That would help greatly. $\endgroup$ – gwr Mar 22 '18 at 13:39
  • $\begingroup$ No one is going to be able to help you without code......... $\endgroup$ – user6014 Mar 22 '18 at 14:04
3
$\begingroup$

As bgodfrey explains in his answer to (89518) Show will use the PlotRange of the first plot given which probably is the case here.

For example plotting your function $f(x) = \left(1 - \alpha\, t^2\right)^2$ for different values of $\alpha$ will show gaps as well:

Show[
 {
  Table[ 
    LogLogPlot[ (1 - α t^2)^2, {t, 0.1, 5}, 
        PlotStyle -> Directive[Thick, Dashed]
    ], 
    { α, {1/2, 1/4, 1/8, 1/6} }] (* change the order here to play around *)
  }
 ]

Plot with Gaps

If you play with the order for the list of values in the table for $\alpha$, you will see that the appearance of gaps is depending on the order. For example, try {1/4, 1/8, 1/6, 1/2}, e.g. put the $1/2$ to the end of the list of values, and look what happens to your gaps.

Including an explicit PlotRange for each plot should solve this:

Show[
 {
  Table[ 
    LogLogPlot[ (1 - α t^2)^2, {t, 0.1, 5}, 
        PlotStyle -> Directive[Thick, Dashed],
        PlotRange -> { {0.1, 5}, {0.01, 5} }
    ], 
    { α, {1/2, 1/4, 1/8, 1/6} }] (* change the order here to play around *)
  }
 ]

Plot without Gaps

$\endgroup$
  • 2
    $\begingroup$ Or put the Table inside the LogLogPlot: LogLogPlot[Evaluate@Table[(1 - \[Alpha] t^2)^2, {\[Alpha], {1/2, 1/4, 1/8, 1/6}}], {t, 0.1, 5}, PlotStyle -> Directive[Thick, Dashed], PlotLegends -> Placed[StringForm["\[Alpha] = ``", #] & /@ {1/2, 1/4, 1/8, 1/6}, {.16, .32}]] $\endgroup$ – Bob Hanlon Mar 22 '18 at 18:28
  • $\begingroup$ @Bob Good advice. I wanted to stay true to the bit of code that the OP gave in his title... $\endgroup$ – gwr Mar 22 '18 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.