Re: Want to plot list with modified x-axis.
- To: mathgroup at smc.vnet.net
 - Subject: [mg20526] Re: [mg20440] Want to plot list with modified x-axis.
 - From: "Wolf, Hartmut" <hwolf at debis.com>
 - Date: Sat, 30 Oct 1999 00:13:48 -0400
 - Organization: debis Systemhaus
 - References: <199910260433.AAA05990@smc.vnet.net.>
 - Sender: owner-wri-mathgroup at wolfram.com
 
I. Ioannou schrieb:
> 
> Hi all,
> 
> I've been trying to plot a list which comes out of a table (a string of
> 10K numbers basically) with modified x-axis. If I were to "listplot", I'd
> get the x-axis to go from 0 to 10,000. I want to scale that by a physical
> factor and plot that way instead.
> 
---x---
Well, John, ListPlot can alternatively accept a List of {x,y} pairs. So
if you specifiy for every y the corresponding 'physical' x-value, you'll
get what you want.
---x---
> 
> Back to my original question, how can I generate these plots? I also tried
> the standard Plot function. However, my function has a lot of sharp
> (resonant) features (Bessel functions) and I don't seem to be able to tell
> Mathematica to plot it properly. I need to fiddle with MaxBend,
> PlotPoints, PlotDivision. Any clarification on these would be wellcome, as
> the help files don't seem entirely clear to me.
> 
> Thanks, John
This feature allows you to deal with different densities for sampling
points at interesting regions (e.g. if for some cause you are
unsatisfied with Plot's build-in sampling algorithm (but that -- to my
experience -- is very good), or for performance reasons or for whatever
reason. Let's make up an example:
In[17]:=
tab0 = Chop[Table[With[{x = i*Pi/10}, 
     y /. FindRoot[x == -Sqrt[y*(2 - y)] + 
         ArcCos[1 - y], {y, x}]], {i, 0, 10}], 10^(-7)]
In[18]:=
tab1 = Join[Reverse[tab0], tab0]; 
This is with an aequidistant spacing of x-samples.
In[27]:=
showTab = Function[tab, 
    Show[Apply[ListPlot[tab, ##1, DisplayFunction -> 
         Identity] & , 
      {{PlotStyle -> PointSize[0.015]}, 
       {PlotStyle -> GrayLevel[0.5], PlotJoined -> 
         True}}, {1}], DisplayFunction -> 
      $DisplayFunction]]; 
In[29]:=
showTab[tab1]
This may be a graph you're unsatisfied with, due to unhappy spacing of
the sampling points and missing accuracy. But if you define your points
in a parametrical fashion...
In[34]:=
tab2 = N[Table[{t - Sin[t], 1 - Cos[t]}, {t, -Pi, Pi, Pi/10}]]
...you'll get something much better (with no more sampling points).
In[35]:=
showTab[tab2]
Kind regards, Hartmut
- References:
- Want to plot list with modified x-axis.
- From: iioannou@u.washington.edu (I. Ioannou)
 
 
 - Want to plot list with modified x-axis.