I want to combine two ListLogPlot plots. For example

p1 = ListLogPlot[Range@100, Frame -> True]
p2 = ListLogPlot[10^4*Range@100, Frame -> True]

I got

Show[p1, p2, PlotRange -> All]

enter image description here

By using the ticks of p2, I got

Show[p1, p2, PlotRange -> All, FrameTicks -> (FrameTicks /. p2[[2]])]

enter image description here

Both of the results have ticks which only cover a part of the figure.

By trying

Show[p1, p2, PlotRange -> All, FrameTicks -> Automatic]

enter image description here

I actually got a wrong result with completely wrong ticks.

So would there be a way to let Show combine the plots and redraw the ticks automatically? Thanks!

Some notes:

(1) There is a similar post:

Scale label problem of multiple ListLogPlot graphs

However, it doesn't solve my problem because the two plots here have different scales which are non-overlapping. Thus the problem is not solved simply by ordering the plots or choosing which ticks to use.

(2) I could instead do ListLogPlot[{Range@100, 10^4*Range@100}]. However, actually each plot command in my realistic case is complicated enough thus it would be easier and more modular for me to draw them separately and combine them afterwards.

  • $\begingroup$ This is quite odd. As a quick fix, you can specify an unusually large plot range in the first plot you feed into Show and fake the frame ticks. So, use p1 = ListLogPlot[Range@100, Frame -> True, PlotRange -> {All, {1, 10^6}}] and the rest of your code the same. $\endgroup$
    – gpap
    Commented Apr 11, 2014 at 15:27
  • $\begingroup$ @gpap : Thanks a lot for the comment! Yes, this is a very good idea. Nevertheless I would expect more convenient ways because I actually have many figures to plot and it's hard for me to predict the range before I get the figure. It would be quite boring (though possible) to tune them one by one... $\endgroup$
    – Yi Wang
    Commented Apr 11, 2014 at 15:30
  • $\begingroup$ Yes, I understand the issue with not knowing the plot range in advance but the point of this is that you won't have to tune them one by one, all you need to tune is the first one. To see what I mean, create another plot p3 in the 10^12 range. Now if you add , PlotRange -> {All, {1, 10^14}} to p1 and use `Show[{p1,p2,p3}, PlotRange -> All] it should look OK. $\endgroup$
    – gpap
    Commented Apr 11, 2014 at 15:40
  • $\begingroup$ (but I agree, there is something going wrong here and this shouldn't be the standard way to fix it) $\endgroup$
    – gpap
    Commented Apr 11, 2014 at 15:41
  • $\begingroup$ Thanks @gpap. Sorry I was not clear. My point is I need to do a lot of Show[p1, p2]; Show[p3, p4]; ... and I mean I have to tune for each pair :) $\endgroup$
    – Yi Wang
    Commented Apr 11, 2014 at 16:29

1 Answer 1


I really don't understand why Show behaves this way with LogPlots. Anyway a way out is to manually extract the the ticks from the plots:

    logShow[a__Graphics, opts : OptionsPattern[Show]] := 
 With[{ft = (FrameTicks /. #[[2]])[[1, 1]] & /@ {a}},
  Show[{a}, FrameTicks -> {All, Join @@ ft}, Evaluate[opts]]

and although this is probably easy to break (I don't know how to write a pattern that tells it that a is a sequence of logplots for instance) it should work.

p1 = ListLogPlot[Range@100, Frame -> True];
p2 = ListLogPlot[10^4*Range@100, Frame -> True];
p3 = ListLogPlot[10^9*Range@100, Frame -> True];


logShow[p1, p2, PlotRange->All]

enter image description here


logShow[p1, p2, p3, PlotRange -> All]

enter image description here

the obvious problem being that it doesn't fill the intermediate ticks between the plots. So better than nothing but not quite as Show is expected to work.

  • $\begingroup$ Thanks a lot for the help! It is not really a perfect solution but considering the automatic way provided by Mathematica is buggy, this may be so far the best that we can do (without tons of coding). So let me accept this answer :) $\endgroup$
    – Yi Wang
    Commented Apr 14, 2014 at 10:27

Your Answer

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

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