Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Frameticks and ListLogLinearPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124003] Re: Frameticks and ListLogLinearPlot
  • From: "Scot T. Martin" <smartin at seas.harvard.edu>
  • Date: Thu, 5 Jan 2012 05:55:45 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201201041006.FAA03473@smc.vnet.net>

Luigi, some things that you think should be simple are in fact hard in Mathematica. Below is an example you can adapt to your own problem. This code would be called with an example like: FrameTicks -> {tickFunction[0, 500, "Style" -> Integer],  tickFunction[0, 6, "Style" -> Decimal], {}, {}}:

In[1]:= Options[tickFunction] = {"Style" -> Automatic}

Out[1]= {"Style" -> Automatic}

In[2]:= Options[tickLabelStyleFunction] = {"Style" -> Automatic}

Out[2]= {"Style" -> Automatic}

In[3]:= tickLabelStyleFunction[value : _,   opts : OptionsPattern[]] :=

 
 Switch[
  OptionValue["Style"],
  
  Automatic,
  value,
  
  Integer,
  IntegerPart[value],
  
  Decimal,
  NumberForm[value, {2, 1}]
  ]

In[4]:= tickFunction[start : _, stop : _, opts : OptionsPattern[]] :=

 
 Map[
  
  Function[
   value,
   {value,
    tickLabelStyleFunction[value, 
     FilterRules[{opts}, Options[tickLabelStyleFunction]]],
    {0, 0.02},
    {Directive[Thickness[0.005]]}
    }
   ],
  
  N@FindDivisions[{start, stop}, 5]
  ]



________________________________________
From: Luigi B [l.balzano at gmail.com]
Sent: Wednesday, January 04, 2012 05:06
To: mathgroup at smc.vnet.net
Subject: [mg124003] Frameticks and ListLogLinearPlot

Dear all,
 I have the problem of adding ticks to a ListLogLinearPlot.
I use the code:

data = {{10^(-6), 72}, {10^(-5), 60}, {10^(-4), 45}, {10^(-3),
     31}, {10^(-2), 33}, {10^(-1), 32}};


ListLogLinearPlot[data, Frame ->  True,
  FrameTicks ->  {Table[{10^-n,
      ScientificForm[1.*10^(-n), NumberFormat ->  (10^#3&)]}, {n,
-1,6}],
    Automatic, Automatic, None}, PlotRange ->  {0, 100}]


this works well as long as the mantissa of the tick is different than
0. However, when this happens it does not work any more.

Could you pls help me out? Or suggest another code to do the same?

Thanks, Luigi




  • Prev by Date: Re: Mathematica on tablet computer
  • Next by Date: Re: Mathematica on tablet computer
  • Previous by thread: Re: Frameticks and ListLogLinearPlot
  • Next by thread: Re: Frameticks and ListLogLinearPlot