Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Consider the following code:

data1 = {{0.70, 0.05}, {0.71, 0.06}, {0.72, 0.07}};
data2 = {{0.72, 0.07}, {0.72, 0.08}, {0.72, 0.1}, {0.72, 0.2}, {0.72,0.4}, {0.73, 0.6},{0.73, 0.8}, {0.73, 1.0}, {0.73, 2.0}, {0.74, 4.0}, {0.74, 5.0}, {0.74, 6.0}, {0.75, 8.0},{0.78, 10.0}};
data3 = {{0.72, 0.07}, {0.74, 0.08}, {0.76, 0.1}, {0.84, 0.2}, {0.9, 0.4}, {0.96, 0.6}, {1.0, 0.8}, {1.02, 1.0}, {1.12, 2.0}, {1.22, 4.0}, {1.26, 5.0}};

sg = ListLogPlot[Tooltip[data1], Joined -> True, Mesh -> Automatic];
sl = ListLogPlot[Tooltip[data2], Joined -> True, Mesh -> Automatic];
lg = ListLogPlot[Tooltip[data3], Joined -> True, Mesh -> Automatic];
Show[sg, sl, lg, PlotRange -> All]

There is no problem with the individual plots but their scales mess up when I combine them using Show command.The scale label just simply disappear. Any idea on how to fix this?

share|improve this question
    
Try: Show[sl, sg, lg, PlotRange -> All]. –  kguler Dec 27 '12 at 8:15
add comment

1 Answer

up vote 2 down vote accepted

From Docs>>Show>>Possible Issues

Show uses the options from the first graphic

In this case, the Ticks and/or FrameTicks options from the first graphic are used unless Show is provided explicit settings for this option. Since the PlotRange and FrameTicks settings for sg cover only a portion of the whole range for sl and lg, you see only the ticks/labels from sg when you use

  Show[sg, sl, lg, PlotRange -> All]

First, few changes in the code to distinguish the three plots when they are `Show'n together:

sg = ListLogPlot[Tooltip[data1], Joined -> True, Mesh -> Automatic, 
  PlotStyle -> Directive[Opacity[.5], Thin, Red]];
sl = ListLogPlot[Tooltip[data2], Joined -> True, Mesh -> Automatic, 
  PlotStyle -> Directive[Opacity[.5], Thickness[.01], Blue]];
lg = ListLogPlot[Tooltip[data3], Joined -> True, Mesh -> Automatic, 
  PlotStyle -> Directive[Opacity[.5], Thickness[.02], Green]];

Since the PlotRange and FrameTicks settings for sl are "more representative" (so to speak), changing the order of graphics in Show

Show[sl, sg, lg, PlotRange -> All, Frame -> True, AspectRatio -> 1]

gives

enter image description here

Alternatively, you could have the input graphics in any order but provide the settings for FrameTicks explicitly in Show to get the same result:

 Show[sg, sl, lg, PlotRange -> All, Frame -> True, AspectRatio -> 1, 
  FrameTicks -> (FrameTicks /. sl[[2]])] 

where I used the facts that

  1. You can get the options (not all of them, btw) of a graphics object by looking into its second Part, that is sl[[2]] contains the option settings PlotRange, AxesLabel, FrameTicks ... etc for sl.
  2. Using the replacement rule FrameTicks /. sl[[2]] we get the values of this option in sl.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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