6
$\begingroup$

I have a very large list of numbers like

list={{a1,b1},{a2,b2},...,{ai,bi}}

where a1 ranges between 10^-9 and 10^-5 and bi varies between 0 and 100. I have generated successfully the plots and am now tweaking them with CustomTicks to look a bit better. But I'm not able to get the XX axis as I want.

The YY axis should be linear and the XX axis should be Logarithmic. But the best I could get was this: Mathematica graphics

Could someone please tell me what I'm doing wrong? I've been trying different things for so long and I can't figure this out.

Here is my code:

a = {#, Random[Real, {0, 100}]} & /@ 
         Union[     Range[1*^-9, 1*^-8, 1*^-9]
              ~Join~Range[1*^-8, 1*^-7, 1*^-8]                  
              ~Join~Range[1*^-7, 1*^-6, 1*^-8]
              ~Join~Range[1*^-6, 1*^-5, 1*^-7]]

ListLogLinearPlot[a, Joined ->True, Axes -> False, FrameLabel -> {{"A", None}, {"B", None}}, 
           Frame -> {{True, False}, {True, False}}, LabelStyle -> {Bold, 25}, 
           PlotStyle -> {{Thickness[0.003], Black}, 
                         {Thickness[0.003], Dashing[0.015], Black}, 
                         {Thickness[0.003], Dashing[0.005], Black}},
           PlotRange -> {0, 100}, ImageSize -> {800, 600}, 
           FrameTicks - {{LinTicks[0, 100, 20, 2], None}, 
                         {LogTicks[E, -8, -5], None}},
           FrameTicksStyle -> Directive[Thickness[0.01]]]
$\endgroup$
2
  • $\begingroup$ This uses the LevelScheme package from wnsl.physics.yale.edu/levelscheme. Have you loaded the package? $\endgroup$ Commented Sep 6, 2012 at 18:40
  • $\begingroup$ Also, one Rule is incomplete ('-' instead of '->'), but that doesn't seem to be the cause. $\endgroup$ Commented Sep 6, 2012 at 18:57

1 Answer 1

7
$\begingroup$

The solution can be found in the CustomTicks manual:

Note that plots with logarithmic axes are actually generated as linear plots, but where the logarithm has been taken of either the x-axis or y-axis variable. Specifically, for base 10,

  1. a logarithmic (or linear-log) plot of $f$ is obtained by plotting $\log_{10} f(x)$,

  2. a log-linear plot of $f$ is obtained by plotting $f(10^x)$, and

  3. a log-log plot of $f$ is obtained by plotting $\log_{10}f(10^x)$ on ordinary linear axes. A similar procedure holds for bases other than 10.

So you really need a normal ListPlot with transformed coordinates instead of a ListLogLinearPlot. Note that the range you used for the log ticks was incorrect too.

a = {Log[a[[All, 1]]], a[[All, 2]]}\[Transpose] 
(* think hard about why the Log here instead of the 10^x mentioned in (2) above *)

ListPlot[a, Joined -> True, Axes -> False, 
            FrameLabel -> {{"A", None}, {"B", None}}, 
            Frame -> {{True, False}, {True, False}}, LabelStyle -> {Bold, 25}, 
            PlotStyle -> {{Thickness[0.003], Black}, {Thickness[0.003], 
                           Dashing[0.015], Black}, {Thickness[0.003], Dashing[0.005], 
                           Black}}, 
            PlotRange -> {0, 100}, ImageSize -> {800, 600}, 
            FrameTicks -> {{LinTicks[0, 100, 20, 2], None}, 
                           {LogTicks[E, -20, -11], None}}, 
             FrameTicksStyle -> Directive[Thickness[0.01]]
]

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ or just a[[All, 1]] = Log[a[[All, 1]]]. $\endgroup$ Commented Sep 6, 2012 at 22:04
  • $\begingroup$ @MikeHoneychurch Replacement in-place. Indeed, more polished. $\endgroup$ Commented Sep 6, 2012 at 22:21
  • $\begingroup$ Thank you guys. Now I understand how this works! Thank you Sjoerd $\endgroup$
    – Sos
    Commented Sep 7, 2012 at 13:46

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.