MathGroup Archive 2007

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

Search the Archive

Re: plotting vectors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83911] Re: plotting vectors
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Tue, 4 Dec 2007 04:25:25 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fj0n02$ir9$1@smc.vnet.net>

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]

Regards,
-- 
Jean-Marc


  • 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