# Showing ListLogPlot and redrawing FrameTicks

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] By using the ticks of p2, I got

Show[p1, p2, PlotRange -> All, FrameTicks -> (FrameTicks /. p2[])] Both of the results have ticks which only cover a part of the figure.

By trying

Show[p1, p2, PlotRange -> All, FrameTicks -> Automatic] 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.

• 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. – gpap Apr 11 '14 at 15:27
• @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... – Yi Wang Apr 11 '14 at 15:30
• 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. – gpap Apr 11 '14 at 15:40
• (but I agree, there is something going wrong here and this shouldn't be the standard way to fix it) – gpap Apr 11 '14 at 15:41
• 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 :) – Yi Wang Apr 11 '14 at 16:29

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 /. #[])[[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];


Indeed:

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

logShow[p1, p2, p3, PlotRange -> All] 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.

• 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 :) – Yi Wang Apr 14 '14 at 10:27
{"ft_lang_label":"__label__en","ft_lang_prob":0.8856105,"math_prob":0.8058002,"size":1481,"snap":"2020-10-2020-16","text_gpt3_token_len":424,"char_repetition_ratio":0.13473256,"word_repetition_ratio":0.06477733,"special_character_ratio":0.30452397,"punctuation_ratio":0.14238411,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99082226,"pos_list":[0,1,2,3,4,5,6,7,8,9,10],"im_url_duplicate_count":[null,5,null,5,null,5,null,5,null,5,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-03-28T21:48:21Z\",\"WARC-Record-ID\":\"<urn:uuid:13219504-dbb3-4bf4-84c2-8e3875b62679>\",\"Content-Length\":\"147922\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2bc17077-d2aa-4255-9921-0aa4236fc3c6>\",\"WARC-Concurrent-To\":\"<urn:uuid:56b67cbf-a23f-4bb9-9a97-9730506c8ef4>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://mathematica.stackexchange.com/questions/45871/showing-listlogplot-and-redrawing-frameticks\",\"WARC-Payload-Digest\":\"sha1:6RWGLJYG2SZPTZSR7VRNORC7BBCYKGDT\",\"WARC-Block-Digest\":\"sha1:ZV436UWNOPG44C7L5KLREBFUD4N4PHYK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-16/CC-MAIN-2020-16_segments_1585370493120.15_warc_CC-MAIN-20200328194743-20200328224743-00042.warc.gz\"}"}