MathGroup Archive 2003

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

Search the Archive

RE: LogLogListPlot, LogLinearListPlot- Ticks and TickMarks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44139] RE: [mg44110] LogLogListPlot, LogLinearListPlot- Ticks and TickMarks
  • From: David.Annetts at csiro.au
  • Date: Fri, 24 Oct 2003 04:24:08 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Hugh,

> I have some data for viscoelastic material that covers a domain of (a
> possibly record breaking) 16 decades.
> There are two data sets in the form of frequency-modulus and
> frequency-phase.
> I wish to plot these as a LogLogListPlot and as a LogLinearListPlot
> respectively.
> I give an example data set and my attempts below.
> 
> For the LogLogListPlot how do I get more tick marks and tick 
> labels on the x
> and y axes in the form of 10^n where n may be positive or 
> negative and is
> not converted either to a decimal or preceded by 1.0 x?
> 
> For the LogLinearListPlot how do I get a sensible y scale on 
> the left hand
> side, perhaps 5 tick marks, keeping the symbol as Pi and 
> fractions of Pi
> rather than as a decimal?  How do I get the y scale on the 
> right hand side
> which is missing?
> 
> Finally is there a method of plotting both the modulus and 
> phase plots, one
> above the other, with a common length of x axis so that the 
> plots line up?

Welcome to the wonderful world of ?Ticks.

Essentially, you have to construct the ticks by hand and use them via
FrameTicks->{myXtik, myYtik}.  This can get messy ....  Rather than play
with LogLogListPlot & LogLinearListPlot as you have done, I'll stick with
ListPlot.  

So ....

For the x-axis ticks we want something like :- 

tiklen = {0.0046875, 0}; (* this is a magic number -- look at
Graphics`Graphics.m for more *)
tikl = Range[-6, 12, 1]; (* our labelled ticks in Log space *)
tikl = {tikl[[#]], ScientificForm[10.^tikl[[#]]], 2 * tiklen} & /@
Range[Length@tikl] (* labelled ticks *)
tikn = Log[10, #] & /@ Range[2., 9];
tikn = 10^# tikn & /@ Range[-5, 12, 1];
tikn = Flatten[Log[10, tikn]]
tikn = {tikn[[#]], "", tiklen} & /@ Range[Length@tikn]; (* unlabelled ticks
*)
tik = Join[tikn, tikl]; (* everything together *)

We can use them (eg)
ListPlot[{Log[10, #[[1]]],#[[2]]}&/@dataPhase,
    PlotRange\[Rule]{{-5.01, 12.01},{-Pi/2,0}},
    FrameLabel\[Rule]{"Frequency","Phase"},FrameTicks->{tik, Automatic}, 
    ImageSize\[Rule]729,
    TextStyle\[Rule]{FontFamily->"Times",FontSize\[Rule]10}];

Slightly extended ranges are necessary to see all the labels.

For the y-axis in the above plot, try ...
ptik = {#, TraditionalForm[#], tiklen} & /@ Range[-Pi/2, 0, Pi/8]

And we can employ these (eg)
ListPlot[{Log[10, #[[1]]],#[[2]]}&/@dataPhase,
    PlotRange\[Rule]{{-5.01, 12.01},{-Pi/2+ .01,0.01}},
    FrameLabel\[Rule]{"Frequency","Phase"},FrameTicks->{tik, ptik}, 
    ImageSize\[Rule]729,
    TextStyle\[Rule]{FontFamily->"Times",FontSize\[Rule]10}];

Returning to your LogLog plot, we'll define the y-axis ticks by
ytikl = Range[-5, 0, 1];
ytikl = {ytikl[[#]], ScientificForm[10.^ytikl[[#]]], 2 *
             tiklen} & /@ Range[Length@ytikl];
ytikn = Log[10, #] & /@ Range[2., 9];
ytikn = 10^# ytikn & /@ Range[-5, 12, 1];
ytikn = Flatten[Log[10, ytikn]];
ytikn = {ytikn[[#]], "", tiklen} & /@ Range[Length@ytikn];
ytik = Join[ytikn, ytikl];

and use them, again noting the slightly extended ranges in log space .... 
ListPlot[Log[10, {#[[1]], #[[2]]}] & /@ dataMod, 
            PlotRange \[Rule] {{-5.01, 12.01}, {-4.01, .01}},
     FrameLabel \[Rule] {"Frequency", "
      Modulus"}, FrameTicks -> {tik, ytik}, ImageSize \[Rule] 729, TextStyle
\
\[Rule] {FontFamily -> "Times", FontSize \[Rule] 10}];

To get these lining up, I suggest either fiddling with GraphicsArray or
investigating Wickham-Jones' ExtendGraphics packages.

Regards,

Dave.
==========================================
  Dr. David Annetts
  EM Modelling Analyst
  CSIRO DEM            Tel: +612 9490 5416
  North Ryde           Fax: +612 9490 5467
  Australia         David.Annetts at csiro.au
===========================================


  • Prev by Date: Re: Why is this replacement not performed the first time?
  • Next by Date: Re: Integrate piecewise with Assumptions
  • Previous by thread: LogLogListPlot, LogLinearListPlot- Ticks and TickMarks
  • Next by thread: Chaos from times series