4

The following MWE does exactly what I want. I'm just wondering if there's an easier, "canonical" way of specifying the color map as I just want black lines.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[view={300}{30}, hide axis=true, ticks=none, unit vector ratio=1.5 1.5 1, line join=round]
    \addplot3[surf, samples=61, domain=-5:5, line width=0.2pt, fill=white, colormap={bw}{gray(0cm)=(0);gray(1cm)=(0);}] {sin(deg(x*y/5))*cos(deg(x*y/2))};
  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

2 Answers 2

2

You could define the colormap a bit simpler, e.g. by colormap={bw}{color=(black) color=(black)}. But you could also do it the following way. Please see the details in the comments of the code.

% used PGFPlots v1.16
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \pgfplotsset{
        compat=1.16,
        % load a colormap that already included black
        % (either at the beginning or at the end)
        colormap/blackwhite,
    }
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        view={300}{30},
        hide axis=true,
        ticks=none,
        unit vector ratio=1.5 1.5 1,
        line join=round,
        samples=61,
    ]
        \addplot3 [
            surf,
            line width=0.2pt,
            fill=white,
            % set the `point meta` value to a constant value
            point meta=0,
        ] {sin(deg(x*y/5))*cos(deg(x*y/2))};
    \end{axis}
\end{tikzpicture}
\end{document}

image showing the result of above code

3

You seem to be looking for a mesh plot, not surf.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[view={300}{30}, hide axis=true, ticks=none, unit vector ratio=1.5 1.5 1, line join=round]
    \addplot3[mesh, samples=61, domain=-5:5, line width=0.2pt,draw=gray] {sin(deg(x*y/5))*cos(deg(x*y/2))};
  \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1
  • 1
    No. I know about mesh plots. This looks different as the hidden lines are shown.
    – Frunobulax
    Jun 29, 2019 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .