1

I am trying to plot some data in a cylindrical coordinate system using PGFPlots. Using the code at the bottom I have been able to create this: 3D plot in cylindrical coordinates

However, I would like to ditch the background box for a circle at the bottom with labels for the angles, as well as a z-axis either in the center, or placed to one side. I have tried the solution provided by hugovdberg here, but I get the following error message:

Package PGF Math Error: Could not parse input '' as a floating point number, sorry. The unreadable part was near ''..

Is there a simple way to edit that contribution, or another way to make what I am looking for?

The data I used is available here A-1.dat:

\documentclass{article}

\usepackage{geometry}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\geometry{
paperwidth=10cm,
paperheight=10cm,
margin=0.5cm
}

\begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}
            \begin{axis}[
            height=9cm,
            width=9cm,
            view={300}{30},
            unit vector ratio*=5 5 1,
            data cs=polar,
            zmin=0, zmax=25,
            xmin=-2.5,xmax=2.5,
            ymin=-2.5,ymax=2.5,
            grid=major,
            xticklabel style={xshift=4pt},
            yticklabel style={yshift=-5pt},
            xtick={-2,-1,...,2},
            ytick={-2,-1,...,2},
            z buffer=sort
            ]
                \addplot3[surf, mesh/cols=52, shader=flat, draw=black, line width=0.2]
                    table[x=angle, y=dist, z=power, col sep=comma]{A-1.dat};
            \end{axis}
    \end{tikzpicture}
\end{figure}
\end{document}
1

Apparently the problem was caused by z buffer=sort, so moved that inside the addplot3 command instead.

Adding clip=false to the axis options was also necessary in order to avoid clipping the node-text.

The following produces a correct result:

\documentclass{article}

\usepackage{geometry}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\geometry{
    paperwidth=10cm,
    paperheight=10cm,
    margin=0.5cm
}

\begin{document}
\begin{figure}
    \centering
    \begin{tikzpicture}
        \begin{axis}[
            height=9cm,
            width=9cm,
            view={300}{30},
            unit vector ratio*=5 5 1,
            data cs=polar,
            zmin=0, zmax=25,
            xmin=-2.5,xmax=2.5,
            ymin=-2.5,ymax=2.5,
            xticklabel style={xshift=4pt},
            yticklabel style={yshift=-5pt},
            xtick=\empty,
            ytick=\empty,
            axis y line = none,
            axis x line = none,
            axis z line = none,
            clip = false,
            ]
            \foreach \thet in {0,30,...,330} {
                % some trickery to get the label expanded
                \edef\doplot{\noexpand\addplot+[domain=0:2.5,mark=none,black] (\thet, \noexpand\x) node[pos=1.2]  {\thet};}
                \doplot
            };
            \addplot3[surf, mesh/cols=52, shader=flat, draw=black, line width=0.2, z buffer=sort]
            table[x=angle, y=dist, z=power, col sep=comma]{A-1.dat};
        \end{axis}
    \end{tikzpicture}
\end{figure}
\end{document}

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.