How Can I Generate and Plot Multiple Y Sets in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter brydustin
  • Start date Start date
  • Tags Tags
    Function Mathematica
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 4K views
brydustin
Messages
201
Reaction score
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?
 
Physics news on Phys.org
In[1]:= Y={1,5,4}; XY=Transpose[{Y,Range[Length[Y]]}]

Out[2]= {{1,1},{5,2},{4,3}}
 
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?