MathGroup Archive 2007

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

Search the Archive

Re: Non numerical x-axis in (Date)ListPlot?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78999] Re: Non numerical x-axis in (Date)ListPlot?
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Sun, 15 Jul 2007 01:09:13 -0400 (EDT)

On 7/14/07 at 2:47 AM, maarten.vanderburgt at icos.be (Maarten van der
Burgt) wrote:

>I have two sets of data:

>dat1 = {{"A1",2},{"A2",3},{"A4",1}}
>dat2 ={{"A1",2.2},{"A2",2.9},{"A3",0.5},{"A4",1.1}}

>Is there a simple way I can plot these with the {"A1", "A2", "A3",
>"A4"} as equidistant tick marks/labels along the horizontal axis and
>a standard numerical vertical axis? Note the missing "A3" in dat1.

>I could not find anything in the options of ListPlot, or in the new
>(6.0) DateListPlot.

You can achieve what you want by using a custom Ticks specification. For ex=
ample,

ListPlot[dat1 /. {a_, b_} :> {ToExpression@StringDrop[a, 1], b},
 Ticks -> {{#, "A" <> ToString@#} & /@ Range[4], Automatic},
 PlotRange -> {{0, 5}, {0, 3.5}}]

--
To reply via email subtract one hundred and four


  • Prev by Date: Re: anyone tried the debugger?
  • Next by Date: Re: Non numerical x-axis in (Date)ListPlot?
  • Previous by thread: RE: Non numerical x-axis in (Date)ListPlot?
  • Next by thread: Re: Non numerical x-axis in (Date)ListPlot?