Mathematica ListPlot function

  • Mathematica
  • Thread starter brydustin
  • Start date
  • #1
205
0
Suppose that I had a set of Y points Y = {y1,y2,.....yN} and I want to plot them again a set X = {1,2,3,.....,N}

Naturally, I would like to do something like:
YX = { {y1, 1} , {y2,2} , ..... , {yN,N} }
followed by
ListPlot[YX,PlotJoined->True]


My question is: How can I construct YX in a very simple manner?
 

Answers and Replies

  • #2
1,069
29
In[1]:= Y={1,5,4}; XY=Transpose[{Y,Range[Length[Y]]}]

Out[2]= {{1,1},{5,2},{4,3}}
 
  • #3
205
0
Thanks........
But what if the set Y was generated in a loop by some arbitrary means, and I wanted to plot Y, and then trash its values, hold the plot, rerun the calculation generating a new Y, and then plot it along with the first Y, keeping the same domain (X).
I know in matlab we would use the HoldOn function, but is there something like this in mathematica?
 

Related Threads on Mathematica ListPlot function

Replies
8
Views
5K
Replies
1
Views
5K
Replies
5
Views
5K
Replies
12
Views
3K
Replies
1
Views
1K
  • Last Post
Replies
2
Views
605
  • Last Post
Replies
1
Views
2K
Replies
4
Views
3K
Top