Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to generate a phase plot of a sinusoidal voltage at discrete points using the following code:

ListPlot[Table[{5*Sin[n*π/4 + π/3], 5*Cos[n*π/4 + π/3]}, {n, 8}],
         AspectRatio -> 1, AxesLabel -> {"Real", "Imaginary"}, PlotLabel -> "Plot 1d"]

I would also like to make it so there is an arrow that originates at the origin and ends at each point on the plane. Also, I would like to label each point with its corresponding value of n. Is this possible? How can I do it?

share|improve this question
1  
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! –  belisarius Jan 17 at 4:17
    
@belisarius thank you for this excellent introductory advice. I certainly would have valued this with my first encounter. It seems a comment that should be reproduced (with attribution). –  ubpdqn Jan 17 at 9:36
1  
@ubpdqn A pity you haven't got one of them. Here is the full set meta.mathematica.stackexchange.com/q/597/193 :) –  belisarius Jan 17 at 12:19

1 Answer 1

t = Table[{n, 5*Sin[n*π/4 + π/3], 5*Cos[n*π/4 + π/3]}, {n, 8}]; 
ListPlot[t[[All, 2 ;;]], AspectRatio -> 1, AxesLabel -> {"Real", "Imaginary"}, 
         PlotLabel -> "Plot 1d", PlotRangePadding -> 2.8] /. 
         Point@x_ :> ({Arrow[{{0, 0}, #}], Text[Nearest[Thread[N@t[[All, 2 ;;]] -> 
                      t[[All, 1]]], #], 1.2 #]} & /@ x)

Mathematica graphics

share|improve this answer
    
Thanks! That is exactly what I meant by the arrows, but I meant for the data point labels to represent the parametric x values, (0,1,2,3,4,5,6,7,8). I apologize. I shouldn't have used x as the parametric variable. –  CrawdadMan Jan 17 at 3:22
    
Thank you so much! Could you please clarify what you did? –  CrawdadMan Jan 17 at 5:29
    
@CrawdadMan sorry, no time today. Perhaps someone else can –  belisarius Jan 17 at 5:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.