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

I'm trying to draw a zero-pole plot for use with some filter design. Since i couldn't find any standard way to go about this, I tried using the polar library of PGFPlots. I'm having some trouble, however. The first plot i did turned out decently, with only poles in it. When i try to add some zeros though, its missing part of the marker used to denote the position.

\begin{tikzpicture}
\begin{polaraxis}[enlargelimits=false, % axis x line = bottom, axis y line=right,
% height=5cm, width=5cm, 
ytick={1}, %axis y line*=none, 
yticklabels={},
xtick={0,45,90,135,180,225,270,315,360},
%xticklabels={},
%separate axis lines=true,
every outer x axis line/.append style={color=red, opacity=0, fill opacity=0},
every outer y axis line/.append style={color=red, opacity=0, fill opacity=0},
xticklabels={0,
$\frac{2\pi}{8}$,
$\frac{4\pi}{8}$,
$\frac{6\pi}{8}$,
$\frac{8\pi}{8}$,
$\frac{10\pi}{8}$,
$\frac{12\pi}{8}$,
$\frac{14\pi}{8}$}
]
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(0,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(2*pi/8,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(4*pi/8,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(6*pi/8,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(8*pi/8,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(10*pi/8,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(12*pi/8,0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=o}] coordinates{(14*pi/8,0.9564)};

    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(0,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(2*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(4*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(6*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(8*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(10*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(12*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={color=black, mark=asterisk}] coordinates{(14*pi/8,2-0.9564)};
    \addplot+[data cs=polarrad,mark options={fill opacity=00, opacity=00, mark=*}] coordinates{(0,1)};
\end{polaraxis}
\end{tikzpicture}

After some testing it seems i get at problem whenever i go above 5 markers. Anything above that, and some of them don't get rendered properly.

Edit: It was a problem with linestyling. I didn't explicitly set it to solid, so it changed after a while. Fixed it now.

share|improve this question

4 Answers 4

You can use only marks option to put all coordinates in one \addplot command.

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[enlargelimits=false, % axis x line = bottom, axis y line=right,
% height=5cm, width=5cm, 
ytick={1}, %axis y line*=none, 
yticklabels={},
xtick={0,45,90,135,180,225,270,315,360},
%xticklabels={},
%separate axis lines=true,
every outer x axis line/.append style={color=red, opacity=0, fill opacity=0},
every outer y axis line/.append style={color=red, opacity=0, fill opacity=0},
xticklabels={0,
$\frac{2\pi}{8}$,
$\frac{4\pi}{8}$,
$\frac{6\pi}{8}$,
$\frac{8\pi}{8}$,
$\frac{10\pi}{8}$,
$\frac{12\pi}{8}$,
$\frac{14\pi}{8}$}
]
\addplot+[data cs=polarrad,only marks, mark options={color=black, mark=o}] coordinates{
(0,0.9564) 
(2*pi/8,0.9564) 
(4*pi/8,0.9564) 
(6*pi/8,0.9564)
(8*pi/8,0.9564)
(10*pi/8,0.9564)
(12*pi/8,0.9564) 
(14*pi/8,0.9564)};

\addplot+[data cs=polarrad,only marks, mark options={color=black, mark=asterisk}] coordinates{
(0,2-0.9564) 
(2*pi/8,2-0.9564) 
(4*pi/8,2-0.9564) 
(6*pi/8,2-0.9564) 
(8*pi/8,2-0.9564)
(10*pi/8,2-0.9564) 
(12*pi/8,2-0.9564) 
(14*pi/8,2-0.9564) 
(0,1)};
\end{polaraxis}
\end{tikzpicture}
\end{document}
share|improve this answer

The problem with the partially drawn markers occurs because you used \addplot +, with the + indicating that the normal plot style list is still going to be used. In the default style list, plots number 6 to 10 are drawn using the option dashed, every mark/.append style=solid, so the lines are dashed, but the markers are drawn solidly. Since you use the option mark options={...}, you're resetting the every mark style, so dashed now also applies to the markers (which you clearly don't want).

So either you could add the option solid to your mark options, or you could solve the whole thing much more elegantly using only two addplot commands:

\addplot [
        data cs=polarrad,
        mark=o,
        only marks,
        samples=8,
        domain=0:14*pi/8
    ] {0.9564};

will plot eight hollow circles at equally spaced positions between the angles 0 and 14*pi/8. Since I didn't use \addplot +, the line style will be set to black, solid automatically (this is the TikZ default). A similar plot command can be used for drawing the asterisks.

Also note that you don't have to provide the whole xtick list explicitly. You can just say xtick={0,45,...,315}: The first two entries determine the starting point and the increment of the list, and the last entry determines the end.

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}

\begin{document}


\begin{tikzpicture}
\begin{polaraxis}[enlargelimits=false,
ytick={1},
yticklabels={},
xtick={0,45,...,360},
every outer x axis line/.append style={transparent},
every outer y axis line/.append style={transparent},
xticklabels={0,
$\frac{2\pi}{8}$,
$\frac{4\pi}{8}$,
$\frac{6\pi}{8}$,
$\frac{8\pi}{8}$,
$\frac{10\pi}{8}$,
$\frac{12\pi}{8}$,
$\frac{14\pi}{8}$},
]
    \addplot [
        data cs=polarrad,
        mark=o,
        only marks,
        samples=8,
        domain=0:14*pi/8
    ] {0.9564};

    \addplot [
        data cs=polarrad,
        mark=asterisk,
        only marks,
        samples=8,
        domain=0:14*pi/8
    ] {2-0.9564};
\end{polaraxis}
\end{tikzpicture}


\end{document}
share|improve this answer

I don't know exactly what you want when you write

Since i couldn't find any standard way to go about this,

Here a code that is standard for me. Some remarks, I forgot how to use mark=*in such case and there is a possibility to write 0 instead of $\frac{0\pi}{8}$ with a macro from print numbers.

Update to plot a mark the code is \draw plot[black, scale=2,mark=asterisk] coordinates {(0,0)}; with the library plotmarks!

\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{%
  arrows,
  calc
}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}

\draw[gray] circle (4cm);
\foreach \x in {0,2,...,14} {%
\draw[gray,
     decoration={
     markings,
     mark= at position 0.82 with {\draw[black] circle (3pt);},
     mark= at position 0.95 with {\draw[black] (-3pt ,-3pt) -- ( 3pt,3pt)
                                         (3pt ,-3pt) -- (-3pt,3pt)
                                         (0   ,-3pt) -- (   0,3pt)
                                         (-3pt, 0)   -- ( 3pt,  0);}},
    postaction={decorate}
    ] (0,0) -- node[pos=1.1,text=black] {$\frac{\x\pi}{8}$}  (360/16*\x:4.5cm) ;
 }
\end{tikzpicture}
\end{document} 

enter image description here

share|improve this answer

I think that using pgfplots for as little is to use a hammer to swat a fly

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[circle,minimum size=8cm,draw,thin](cercle) at (0,0){};
\foreach \tt in{ 2,4,6,8,10,12,14}{
\draw[thin] (0,0) -- (cercle.{\tt*22.5}) node[pos=1.1]{$\frac{\tt\cdot \pi}{8}$};
}
\draw[thin] (0,0) -- (cercle.{0}) node[pos=1.1]{$0$};
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

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.