0
$\begingroup$

This question was inspired by How to get grid lines at all (log) tick marks in Version 10?, which I was trying to follow to solve my problem. I am trying to plot together, in a Show function, a ListLogLogPlot and a LogLogPlot. I encounter the following issues:

1) when in PlotRange I turn the x-range from {1,10} to something like {10^-4,10^3}, the nice feature described in the overmentioned question fails. That is, I don't see the lines at each log tick anymore. The same thing happens if I change the y-range. This seems to happen when I go over a range of 6 orders of magnitude. How to get them back?

2)I also notice that using Frame->True makes the AxesLabel vanish. How to get it back?

I also tried to move these options from LogLogPlot to Show, but it fails to work as I would like.

Z0Num = 0.1;
Show[LogLogPlot[{beta, beta^2}, {beta, 1, 10}, 
PlotRange -> {{10^-4, 10^3}, {0.0001, 10^3}}, GridLines -> All, 
AxesLabel -> {"\[Beta]", "\.08F(\[Beta])"}, 
PlotLegends -> {{"1", "2"}, 
Placed[Grid[{{StringForm["Z0=``", NumberForm[Z0Num, 4]]}}], {{0.8,
0.9}, {1, 1}}]}, PlotLabel -> "Label"], 
ListLogLogPlot[{{1, 10}, {2, 100}}, PlotStyle -> Red, Joined -> True,
PlotLegends -> {"3"}], ImageSize -> Large, Frame -> True]

These are the 2 different outputs. I am looking for something like the first one, on a wider range and with the frame together with the AxesLabels.

enter image description here

enter image description here

$\endgroup$
  • 1
    $\begingroup$ With regard to AxesLabel vanishing, consider this. You will need to change AxesLabel to FrameLabel to make it work with a Frame. $\endgroup$ – gwr Apr 27 '17 at 11:13
2
$\begingroup$

I would proceed accordingly:

Define unlabeled ticks: unl = Log10@Range[2, 9, 1] // N; Propagate these over the range of interest: unl = # + unl & /@ Range[-4, 3] // Flatten;

Set up labeling: lab = Range[-4, 3];

Now we can assemble our ticks:

tik = Join[
   {10.^#, ""} & /@ unl,
   {10.^#, 10.^#} & /@ lab];

You want a grid too? Same trick but without the labels:

grd = Log10@Range[1, 9, 1];
grd  = # + grd & /@ Range[-4, 4] // Flatten // N;

Put it all together, noting that we'll use FrameLabel not axis label:-

LogLogPlot[{beta, beta^2}, {beta, 1, 10}, 
 PlotRange -> {{10^-3, 10^3}, {0.001, 10^3}}, GridLines -> All, 
 FrameLabel -> {"\[Beta]", "\.08F(\[Beta])"},
 FrameTicks -> {{tik, tik}, {tik, tik}},
 GridLines -> grd,
 ImagePadding -> {{Automatic, 40}, {Automatic, 15}},
 PlotLegends -> {{"1", "2"}, 
   Placed[Grid[{{StringForm["Z0=``", NumberForm[.1, 4]]}}], {{0.8, 
      0.9}, {1, 1}}]}, PlotLabel -> "Label"]

enter image description here

Interestingly, you can get away with Gridlines->Automatic for this plot range.

If you absolutely need your original plot range and so many grid lines, then I'd manually define those lines and use them with Prolog.

$\endgroup$

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.