0
$\begingroup$

I have plotted two functions as below:

p1= LogLogPlot[RO, {t, 0.00001, 0.05}, PlotRange -> All, PlotStyle -> {Purple}];

p2=LogLogPlot[R1, {t, 0.00001, 0.05}, PlotRange -> All, PlotStyle -> {Red}];

I then use Show to combine them:

Show[p2, p1]

My question is how can I use

Show

so that it shows p1 and p2 only in the interval $10^{-5}<t<10^{-4}$?

I used

Show[p1,p2, PlotRange -> {10^(-5),10^(-4)}]

but the output is not in the interval $10^{-5}<t<10^{-4}$.

$\endgroup$
2
$\begingroup$

Since Show uses the PlotRange setting from the first plot, you can just set your plot range when defining the first plot:

p1=LogLogPlot[
    RO,
    {t,0.00001,0.05},
    PlotRange -> {{10^-5, 10^-4}, All},
    PlotStyle->{Purple}
];

Show[p1, p2]

or you can use a dummy plot with the desired plot range:

p0 = LogLogPlot[None, {t, 10^-5, 10^-4}];

Show[p0, p1, p2]

If you really want to set the PlotRange using a Show option, than you need to realize that the Graphics objects produced by p1 and p2 don't know that "Log" scaling functions were used. So, you need to adjust the desired PlotRange accordingly:

Show[p1, p2, PlotRange -> {Log @ {10^-5, 10^-4}, All}]
$\endgroup$
1
$\begingroup$

Your syntax is incorrect, it should be

Show[{p1,p2},PlotRange->{{x_min,x_max},{y_min,y_max}}]

If you want all in y, you can do:

Show[{p1,p2},PlotRange->{{10^(-5),10^(-4)},All}]
$\endgroup$
  • $\begingroup$ Unfortunately, It doesn't work. $\endgroup$ – Zhi Ruo Jun 6 at 15:51
  • $\begingroup$ @ZhiRuo no, because you are using a loglog plot you need to rescale the plot range as shown in the other answer. Your syntax was, however, still incorrect, as I pointed out for you. $\endgroup$ – bjorn Jun 6 at 17:13

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.