How can I draw an Argand diagram in LaTeX? If you would like an example of the sort of diagram I'd like to draw in LaTeX here is one a DuckDuckGo search found me: http://physicsforidiots.com/wp/wp-content/uploads/2014/07/5throot6.jpg. The only differences between that and what I want is I want the lines connecting the roots and the origin to be dotted, I would like r and theta not to be shown or labelled and I do not want the colour yellow to appear in the diagram at all. I have seen this related question, Drawing a circle in the complex plane., but it didn't include any information about labelling points on the circle, or connecting them to the origin.
1 Answer
Here is a simple solution based on pstricks
:
\documentclass[border=6pt, svgnames]{standalone}%
\usepackage{sansmath}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture*}(-3.5,-3)(6.5,3)
\sansmath $ \everypsbox{\scriptstyle}
\psset{dash =2.5pt 2pt}
\psaxes[ticks=none, labels=none](0,0)(-3.5,-3)(6.5,3)
\psline[linecolor=white, linewidth=1pt](0,0)(1.43,0)
\pnode(0,0){O}\psdot(6,0) \uput[d](6,0){6}
\psset{fillstyle=solid}
\pswedge[linestyle=none, fillcolor=Yellow!40](O){1.43}{0}{72}
\pscircle[fillstyle=none](O){1.43}
\multido{\Iangle=0+72,\i=0+1}{5}{\dotnode[dotstyle=o, dotsize=3.5pt, fillcolor=cyan](1.43;\Iangle){A\i}%
\ncline[linestyle=dashed, linewidth=0.5pt, nodesepB=1.5pt]{O}{A\i}}
\pstMarkAngle[linewidth=0.5pt, fillcolor=white, LabelSep=0.55]{A0}{O}{A1}{\theta}
\uput[dr](A0){1.43}
\uput[r](A1){0.44+1.36\mathsf{i}}
\uput[ul](A2){-1.16+0.84\mathsf{i}}
\uput[ul](A3){-1.16-0.84\mathsf{i}}
\uput[dr](A4){0.44-1.36\mathsf{i}}$
\end{pspicture*}
\end{document}
-
Looks great, although unfortunately it doesn't seem to be working for me, I get this error from copying the document part of this code and adding the two package lines to the top of my file and building it: paste2.org/KsJN0L9L. I get the same error when I just straight copy-paste this all into a new .tex file and build it in TexMaker. Mar 15, 2020 at 16:20
-
-
I think so; this is at the top of the log file: paste2.org/mkBMsW55. Mar 15, 2020 at 16:23
-
Yes, the preloaded fomat is
pdflatex
. The are several ways to make it work: the old way follows thelatex-dvips-pstopdf
path. But you also can compile withxelatex
. It can also work withpdflatex
if you load theauto-pst-pdf
package (after pstricks) and compile with the--enable--write18
option (MiKTeX) or-shell-escape
(TeX Live, MacTeX), because pdftex does not have the computing capabilities that are required by postscript, so it has to oursource part of the job. In my opinion,, the simplest is to use xelatex as a standalone file, then use\includegraphics
.– BernardMar 15, 2020 at 16:37 -
Seems like even XeLaTeX has significant limitations here, i.imgur.com/HcjUY5B.png. Mar 15, 2020 at 16:41