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?

  • 1
    $\begingroup$ 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! $\endgroup$ Jan 17 '14 at 4:17
  • $\begingroup$ @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). $\endgroup$
    – ubpdqn
    Jan 17 '14 at 9:36
  • 1
    $\begingroup$ @ubpdqn A pity you haven't got one of them. Here is the full set meta.mathematica.stackexchange.com/q/597/193 :) $\endgroup$ Jan 17 '14 at 12:19
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

  • $\begingroup$ 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. $\endgroup$
    – CrawdadMan
    Jan 17 '14 at 3:22
  • $\begingroup$ Thank you so much! Could you please clarify what you did? $\endgroup$
    – CrawdadMan
    Jan 17 '14 at 5:29
  • $\begingroup$ @CrawdadMan sorry, no time today. Perhaps someone else can $\endgroup$ Jan 17 '14 at 5:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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