1

I am a novice to pgfplot, but got some web examples to create my own vectorized images. Since my specific problem has a vector field just at the upper region of the plane, I would like to draw just this part. For those who think "just plot the upper side of the axis", I have already thought it and, no, that is no acceptable answer. The goal is to plot more complex regions to make a domain with multiple different vector fields. The code is below. The exact region are separated by the curve on this plot:

\begin{tikzpicture}
    \begin{axis}[
        axis equal,
        title={$u = 1$},
        domain=-2:2,
        view={0}{90},
        axis background/.style={fill=white},
    ]
        \addplot3[blue,
            quiver={
             u={y},
             v={-x + 1},
             scale arrows=0.1,
             domain=0:2
            },
            -stealth,samples=15]
                {0.5*((x - 1)^2 + y^2)};
    \end{axis}
\end{tikzpicture}

I thank for the help and await anxiously. The proper region delimited by a line that separates the two fields I would like to draw is below.

enter image description here

Best regards.

1 Answer 1

1

pgfplots is based on TikZ, which allows you to clip.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        axis equal,
        title={$u = 1$},
        domain=-2:2,
        view={0}{90},
        axis background/.style={fill=white},
    ]
    \clip (-2.5,0,0) -- (-1,0,0) arc (180:360:0.5) 
    arc (180:0:0.5) -- (2.5,0,0) -- (2.5,2.5,0) -| cycle;
        \addplot3[blue,
            quiver={
             u={y},
             v={-x + 1},
             scale arrows=0.1,
            % domain=0:2
            },
            -stealth,samples=15]
                {0.5*((x - 1)^2 + y^2)};
    \end{axis}
\end{tikzpicture}
\end{document}

enter image description here

1
  • You are clearly a marvelous magician, Sir.
    – Bruno Lobo
    Commented Jan 4, 2019 at 18:27

You must log in to answer this question.

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