MathGroup Archive 1999

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

Search the Archive

Re: plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18952] Re: [mg18241] plot
  • From: Markus van Almsick <m.van.almsick at cityweb.de>
  • Date: Fri, 30 Jul 1999 01:33:44 -0400
  • References: <199906241824.OAA09274@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Frank,

RE:

>If I have a list such as { 1, 2, 3, 4, 4}, I want to plot the list that
>a verticle line will be draw from the x axis to end at the value. How
>to do it?

Here are two functions that do the job:

for a list of data values use:

LinePlot[data : {__?NumericQ}] :=
   Show[Graphics[
       MapThread[Line[{{#1, 0}, {#1, #2}}] &, {Range[Length[data]], data}],
       Axes -> True]]

LinePlot[{1, 1, 3, 4, 4}]


for a list of data (x,y)-pairs use:

LinePlot[data : {{_?NumericQ, _?NumericQ} ..}] :=
   Show[Graphics[MapThread[Line[{{#1, 0}, {#1, #2}}] &, Transpose[data]],
       Axes -> True]]

LinePlot[{{1, 1}, {2, 1}, {3, 3}, {4, 4}, {4.5, 4}}]



Hope that answers the question!


Ciao, Markus van Almsick



  • Prev by Date: Help on GroupOpenCloseIcon
  • Next by Date: Discrete Convolution
  • Previous by thread: Help on GroupOpenCloseIcon
  • Next by thread: Discrete Convolution