Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Changing Plot Axis Displays

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54757] Re: [mg54694] Changing Plot Axis Displays
  • From: "Christoph Lhotka" <lhotka at astro.univie.ac.at>
  • Date: Tue, 1 Mar 2005 01:58:12 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On Sun, 27 Feb 2005 01:29:19 -0500 (EST)
 "plizak" <plizak at gmail.com> wrote:
> 
> I have a table that I want to plot, it's a list plot
> 
> A = {{.1,.2,.3,.4,.5}
>      {.1,.2,.3,.4,.6}
>      {.1,.2,.3,.5,.7}
>      {.1,.2,.5,.6,.8} }
> 
> ListPlot3D[A, AxesLabel->{"Years", "Ratings", "rates"}
> 
> Q: I would like the "Ratings" axis to not be numbers 1,2,3
>    and 4, but rather A, B, C, and D.  Is this possible in
>    mathematica?
> 
> Q: Can I change the "rates" to be in Percent?  i.e instead of
>    having the Z axis from 0 to 0.80, could I have the Z axis
>    go from 0% to 80%?
> 
> Q: Can I offset the "Years" to be 5, 10, 15 and 20 as opposed
>    to 1,2,3 and 4?
> 
> 
> 
> Range, Ranges, ListPlot
> 

Hi!
Use Ticks or FrameTicks as an option in the Plot - function.Tick-specification
is done for each dimension in the form: {{x1, label1},{x2,label2},...} . You
can even specify the scaled length, the direction and the style of the
tickmark if you define a list like {{x1, label1,length1, style1},{x2,label2,
length2, style2},...}. You can also use the token None or Automatic (default
value) or a function f(xmin, xmax), which creates a list of tickmarks
depending on the minum and maximum value of the data set. So according to your
questions:

A1:  
In[..]:= fx[min_, max_]:=With[{valrange = Range[min, max, (max - min)/5]},
    Table[{valrange[[i]], CharacterRange["A", "Z"][[i]]}, {i, 1, 
        Length[valrange]}]]

   ,will create a list of 5 tickmarks between Min[yearlist],Max[yearlist] of
your specified form:

In[..]:=fx[1,10]
Out[..]:= {{1,"A"},{2,"B"},...}

A2:
In[..]:=fy[min_, max_] := With[{valrange = Range[min, max, (max - min)/5]},
    Table[{valrange[[i]], 5*i}, {i, 1, Length[valrange]}]]

  ,plots 5 tickmarks between Min[Ratings] and Max[Ratings]:

In[..]:=fy[1,10]
Out[..]:={{1,5},{2,10},...}

and

A3:
In[..]:=fz[min_, max_] := 
  With[{valrange = Range[min, max, (max - min)/4]}, 
    Inner[List, valrange, 100*Rescale[valrange], List]]
In[..]:=f[1,5]
Out[..]:={{1, 0.}, {2, 25.}, {3, 50.}, {4, 75.}, {5, 100.}}

plots 4 tickmarks between Min[rates] and Max[rates], where the function
//100*Rescale[valrange]// sets min to 0% and max to 100%.

In[..]:=ListPlot3D[A, AxesLabel -> {"Years", "Ratings", "rates"},
                   Ticks ->{fx, fy, fz}]

Out[..]...

See more examples and detailed information in the HelpBrowser...

-- Christoph Lhotka --
University of Vienna
Institute for Astronomy
Tuerkenschanzstr. 17 
1180 Vienna, Austria
fon. +43.1.4277.518.41
mail. lhotka at astro.univie.ac.at


  • Prev by Date: Re: Bug in Import?
  • Next by Date: New in 5.1.1?
  • Previous by thread: Re: Re: Changing Plot Axis Displays
  • Next by thread: Re: Re: nonlinear differential equation