MathGroup Archive 2007

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

Search the Archive

Re: plotting vectors

fcs04001 wrote:

> Suppose that I have two vectors x and y, each with 72 elements. I want to plot them, but not have to type {x1,y1},{x2,y2},...etc for all 72 pairs. Is there an easy way to do that? I know that in another system this is pretty easy, but am having difficulty with Mathematica to perform that.

(* First we compute some data *)

x = Table[N@x, {x, 0, 2 Pi, 2 Pi/72}];
y = Table[Sin[x] + RandomReal[{-0.10, 0.10}], {x, 0, 2 Pi, 2 Pi/72}];

(* Here are only few examples among many that answer your question *)

ListPlot[Transpose@{x, y}]

Thread[{x, y}] // ListPlot

MapThread[List, {x, y}] // ListPlot

ListPlot@Inner[List, x, y, List]


  • Prev by Date: Re: plotting vectors
  • Next by Date: ContourLabel placement
  • Previous by thread: Re: plotting vectors
  • Next by thread: Slider[] and Dynamic[] implementation details