# help with complex plane image

Is it possible to draw the following image to replace -1i and 1i with just -i and i? Thanks!

\documentclass[landscape]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\RequirePackage[scaled]{helvet}  % Helvetica, scaled 95%
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}

\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{OT1}{phv}{m}{n}
\SetSymbolFont{letters}{sans}{OML}{phv}{m}{it}
\SetSymbolFont{symbols}{sans}{OMS}{phv}{m}{n}
\SetMathAlphabet{\mathit}{sans}{OT1}{phv}{m}{sl}
\SetMathAlphabet{\mathbf}{sans}{OT1}{phv}{bx}{n}
\SetMathAlphabet{\mathtt}{sans}{OT1}{phv}{m}{n}
\SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}

\DeclareMathVersion{boldsans}
\SetSymbolFont{operators}{boldsans}{OT1}{phv}{b}{n}
\SetSymbolFont{letters}{boldsans}{OML}{phv}{b}{it}
\SetSymbolFont{symbols}{boldsans}{OMS}{phv}{b}{n}
\SetMathAlphabet{\mathit}{boldsans}{OT1}{phv}{b}{sl}
\SetMathAlphabet{\mathbf}{boldsans}{OT1}{phv}{bx}{n}
\SetMathAlphabet{\mathtt}{boldsans}{OT1}{phv}{b}{n}
\SetSymbolFont{largesymbols}{boldsans}{OMX}{iwona}{bx}{n}

\newif\IfInSansMode
\let\oldsf\sffamily
\renewcommand*{\sffamily}{\oldsf\mathversion{sans}\InSansModetrue}
\let\oldbf\bfseries
\renewcommand*{\bfseries}{\oldbf\IfInSansMode\mathversion{boldsans}\else\mathversion{bold}\fi\relax}
\let\oldnorm\normalfont
\renewcommand*{\normalfont}{\oldnorm\InSansModefalse\mathversion{normal}}
\let\oldrm\rmfamily
\renewcommand*{\rmfamily}{\oldrm\InSansModefalse\mathversion{normal}}

\renewcommand{\sfdefault}{phv}

\begin{document}
\sffamily \bfseries
\begin{center}
\begin{tikzpicture}
\begin{scope}[thick,font=\scriptsize]
% Axes:
% Are simply drawn using line with the -> option to make them arrows:
% The main labels of the axes can be places using nodes:
\draw [stealth-stealth] (-4,0) -- (4,0); %node [above left]  {$\Re\{z\}$};
\draw [stealth-stealth] (0,-4) -- (0,4);  %node[center](i){Here $i$ Am!} %node [below right] {$\Im\{z\}$};

%draw the parallelogram
\draw[dashed] (0, 0)--(3,2) node[circle,fill,inner sep=1pt]{};
\draw[dashed] (3, 2)--(2,3) node[circle,fill,inner sep=1pt]{};
\draw[dashed] (-1, 1)--(2,3) node[circle,fill,inner sep=1pt]{};
\draw[dashed] (0,0)--(-1,1) node[circle,fill,inner sep=1pt]{};

%label the parallelogram
\draw (-1, 1) node[circle,fill,inner sep=1pt,label=left:$-1+i$]{};
\draw (0, 0) node[circle,fill,inner sep=1pt,label=above:\hskip1.5em$0$]{};
\draw (3, 2) node[circle,fill,inner sep=1pt,label=right:$3+2i$]{};
\draw (2, 3) node[circle,fill,inner sep=1pt,label=right:$2+3i$]{};

% Axes labels:
% Are drawn using small lines and labeled with nodes. The placement can be set using options
\iffalse% Single
% If you only want a single label per axis side:
\draw (1,-3pt) -- (1,3pt)   node [above] {$1$};
\draw (-1,-3pt) -- (-1,3pt) node [above] {$-1$};
\draw (-3pt,1) -- (3pt,1)   node [right] {$i$};
\draw (-3pt,-1) -- (3pt,-1) node [right] {$-i$};
\else% Multiple
% If you want labels at every unit step:
\foreach \n in {-4,...,-1,1,2,...,4}{%
\draw (\n,-4pt) -- (\n,4pt)   node [above] {$\n$};
\draw (-4pt,\n) -- (4pt,\n)   node [right] {$\n i$};
}
\fi
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}


• Welcome to TeX.SE. You can have a look at our starter guide to familiarize yourself further with our format. If you indent four spaces your code a block is created. – skpblack Oct 23 '14 at 15:04
• Do you mean replace -1+i? – Sigur Oct 23 '14 at 15:42
• @Sigur I think s/he wants to replace the axis markers from 1i, 2i, 3i, ... to i, 2i, 3i, ... – Enthusiastic Engineer Oct 23 '14 at 15:46
• Thanks! So, as the code is now, I have the axis markers -4i, -3i, -2i, -1i, ... , 1i, 2i, 3i, 4i. I would like for the axis markers to be -4i, -2i, -i, ..., i, 2i, 3i, 4i. Hope this makes sense! – Natalya Oct 23 '14 at 15:51
• @Natalya I plotted your question with aid of pgfplots. Please take a look at my answer. – Enthusiastic Engineer Oct 23 '14 at 17:59

You can use \ifnum to test to see if \n is 1 or -1 and adjust the label:

\ifnum\n=1
\textcolor{red}{$i$}
\else
\ifnum\n=-1
\textcolor{red}{$-i$}
\else
$\n i$
\fi
\fi


## Notes:

• Added red color to make the changes more obvious.
• It is better to use pgfplots for graphing instead of just tikz.

## Code:

\documentclass[landscape]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\RequirePackage[scaled]{helvet}  % Helvetica, scaled 95%
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}

\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{OT1}{phv}{m}{n}
\SetSymbolFont{letters}{sans}{OML}{phv}{m}{it}
\SetSymbolFont{symbols}{sans}{OMS}{phv}{m}{n}
\SetMathAlphabet{\mathit}{sans}{OT1}{phv}{m}{sl}
\SetMathAlphabet{\mathbf}{sans}{OT1}{phv}{bx}{n}
\SetMathAlphabet{\mathtt}{sans}{OT1}{phv}{m}{n}
\SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}

\DeclareMathVersion{boldsans}
\SetSymbolFont{operators}{boldsans}{OT1}{phv}{b}{n}
\SetSymbolFont{letters}{boldsans}{OML}{phv}{b}{it}
\SetSymbolFont{symbols}{boldsans}{OMS}{phv}{b}{n}
\SetMathAlphabet{\mathit}{boldsans}{OT1}{phv}{b}{sl}
\SetMathAlphabet{\mathbf}{boldsans}{OT1}{phv}{bx}{n}
\SetMathAlphabet{\mathtt}{boldsans}{OT1}{phv}{b}{n}
\SetSymbolFont{largesymbols}{boldsans}{OMX}{iwona}{bx}{n}

\newif\IfInSansMode
\let\oldsf\sffamily
\renewcommand*{\sffamily}{\oldsf\mathversion{sans}\InSansModetrue}
\let\oldbf\bfseries
\renewcommand*{\bfseries}{\oldbf\IfInSansMode\mathversion{boldsans}\else\mathversion{bold}\fi\relax}
\let\oldnorm\normalfont
\renewcommand*{\normalfont}{\oldnorm\InSansModefalse\mathversion{normal}}
\let\oldrm\rmfamily
\renewcommand*{\rmfamily}{\oldrm\InSansModefalse\mathversion{normal}}

\renewcommand{\sfdefault}{phv}

\begin{document}
\sffamily \bfseries
\begin{center}
\begin{tikzpicture}
\begin{scope}[thick,font=\scriptsize]
% Axes:
% Are simply drawn using line with the -> option to make them arrows:
% The main labels of the axes can be places using nodes:
\draw [stealth-stealth] (-4,0) -- (4,0); %node [above left]  {$\Re\{z\}$};
\draw [stealth-stealth] (0,-4) -- (0,4);  %node[center](i){Here $i$ Am!} %node [below right] {$\Im\{z\}$};

%draw the parallelogram
\draw[dashed] (0, 0)--(3,2) node[circle,fill,inner sep=1pt]{};
\draw[dashed] (3, 2)--(2,3) node[circle,fill,inner sep=1pt]{};
\draw[dashed] (-1, 1)--(2,3) node[circle,fill,inner sep=1pt]{};
\draw[dashed] (0,0)--(-1,1) node[circle,fill,inner sep=1pt]{};

%label the parallelogram
\draw (-1, 1) node[circle,fill,inner sep=1pt,label=left:$-1+i$]{};
\draw (0, 0) node[circle,fill,inner sep=1pt,label=above:\hskip1.5em$0$]{};
\draw (3, 2) node[circle,fill,inner sep=1pt,label=right:$3+2i$]{};
\draw (2, 3) node[circle,fill,inner sep=1pt,label=right:$2+3i$]{};

% Axes labels:
% Are drawn using small lines and labeled with nodes. The placement can be set using options
\iffalse% Single
% If you only want a single label per axis side:
\draw (1,-3pt) -- (1,3pt)   node [above] {$1$};
\draw (-1,-3pt) -- (-1,3pt) node [above] {$-1$};
\draw (-3pt,1) -- (3pt,1)   node [right] {$i$};
\draw (-3pt,-1) -- (3pt,-1) node [right] {$-i$};
\else% Multiple
% If you want labels at every unit step:
\foreach \n in {-4,...,-1,1,2,...,4}{%
\draw (\n,-4pt) -- (\n,4pt)   node [above] {$\n$};
\draw (-4pt,\n) -- (4pt,\n)   node [right] {%
\ifnum\n=1
\textcolor{red}{$i$}
\else
\ifnum\n=-1
\textcolor{red}{$-i$}
\else
$\n i$
\fi
\fi
};
}
\fi
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}

• Oooh, this is so elegant, Peter, thanks. I started something kind of like this but got stuck with the syntax with the if statements. Looks great!! – Natalya Oct 23 '14 at 23:45

You can plot your question in imaginary plane with an easier code, using pgfplots.

%pdflatex
\documentclass[margin=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}
\begin{tikzpicture}

\begin{axis}
[
ytick ={-7,...,8}, yticklabels={$-7i$, $-6i$, $-5i$, $-4i$, $-3i$, $-2i$, $-i$, $0$, $i$, $2i$, $3i$, $+3i$, $+4i$, $+5i$, $+6i$, $+7i$, $+8i$},
axis lines = center,
grid=both,
minor tick num=1,
ticks=both,
xlabel=$Re(z)$,
ylabel=$Im(z)$,
ymin=-4,
ymax=+5,
xmin=-5,
xmax=+5
]

\addplot [black, mark = *] coordinates {( 0, 0)} {};
\addplot [black, mark = *] coordinates {( 3, 2)} {};
\addplot [black, mark = *] coordinates {( 2, 3)} {};
\addplot [black, mark = *] coordinates {( -1, 1)} {};

\node [below right, red] at (axis cs:  0, 0) {};
\node [right, red] at (axis cs:  3, 2) {$3+2i$};
\node [above, red] at (axis cs:  2, 3) {$2+3i$};
\node [left, red] at (axis cs:  -1, 1) {$-1+i$};

\addplot [dashed, black] coordinates { (0,0) (3,2) };
\addplot [dashed, black] coordinates { (3,2) (2,3) };
\addplot [dashed, black] coordinates { (2,3) (-1,1) };
\addplot [dashed, black] coordinates { (-1,1) (0,0) };

\end{axis}
\end{tikzpicture}

\end{document}