MathGroup Archive 2004

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

Search the Archive

Re: Scientific Notation in ListPlot Axes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47382] Re: Scientific Notation in ListPlot Axes
  • From: riley.freeland at corning.com (Riley Freeland)
  • Date: Wed, 7 Apr 2004 03:16:44 -0400 (EDT)
  • References: <c4u20u$9ak$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The easiest way is to have the ticks be:

Ticks -> {Table[{10^x, DisplayForm[SuperscriptBox["10", x]]}, {x, -6,
-1}], Automatic}
Ticks -> {Table[{10^x, ScientificForm[1.*10^x, NumberFormat -> (10^#3
& )]}, {x, -6, -1}], Automatic}


Or, you can plot the data with automatic ticking, and replace the
ticklabels:

(* plot the data, without displaying it *)
plt = LogLinearListPlot[data, PlotRange -> {0, 100}, TextStyle ->
FontSize -> 12, DisplayFunction -> Identity];

(* strip out the major ticks, i.e. those with labels *)
majorTicks = Select[(Ticks /. AbsoluteOptions[plt])[[1]], #1[[2]] =!=
"" & ];

(* strip out the minor ticks, i.e. those without labels *)
minorTicks = Select[(Ticks /. AbsoluteOptions[plt])[[1]], #1[[2]] ===
"" & ];

(* replace the tick label with the proper formatting, and join them to
the minor ticks *)
xTicks = Join[(ReplacePart[##1, ScientificForm[#1[[2,1]], NumberFormat
-> (10^#3 & )], 2] & ) /@ majorTicks, minorTicks];

(* replot the data *)
Show[plt, Ticks -> {xTicks, Automatic}, DisplayFunction ->
$DisplayFunction];

> Hi,
> 
> I apologize up front for posting a seemingly FAQ...but I searched the
> archives and did not find what I need.
> 
> How can I format the axis of a LogLinearListPlot to display tick
> labels as scientific notation without the "1 x " portion?  In other
> words, I'd just like to display the base 10 and superscript exponent. 
> Here is an example of a plot whose x-axis I'd like to label in this
> way:
> 
> data = {{10^-6,72},{10^-5,60},{10^-4,45},{10^-3,31},{10^-2,33},{10^-1,32}}
> << Graphics`Graphics`
> LogLinearListPlot[data,
> Ticks->{{10^-6,10^-5,10^-4,10^-3,10^-2,10^-1},Automatic},
> PlotRange->{0, 100}]
> 
> Many thanks in advance for your help.
> 
> Best regards,
> 
> Pat


  • Prev by Date: Re: Scientific Notation in ListPlot Axes
  • Next by Date: Re: problems with FindRoot: what worked with 4.2 does not work with 5.0
  • Previous by thread: Re: Scientific Notation in ListPlot Axes
  • Next by thread: Re: Scientific Notation in ListPlot Axes