PGFPlot 矢量场显示不均匀

PGFPlot 矢量场显示不均匀

我有一个简单的二维向量,但是这些点的排列使得顶部向上的向量不包含在图中。我想知道是否有办法让矢量场分布得更均匀,如这里所示,在此处输入图片描述

该图像是 pgfplot 中的第二个轴。

 \begin{figure}[h]
 \begin{tikzpicture}
 \begin{axis}[
     ticks=none,
    view     = {0}{90},
  domain   = -1:1,
  y domain = -1:1,
  samples  = 21,
  xmax     = 1,
  ymax     = 1
]
\addplot3 [blue, quiver={u={-(x)/(x^2+y^2)}, v={-(y)/(x^2+y^2)}, scale 
arrows=0.04},samples=8,->] (x,y,0);
\draw (axis cs:0,0) node [above] {$z_0$};
\filldraw(axis cs: 0,0)circle(1pt); 

\end{axis}
\begin{axis}[ xshift=8cm,
ticks=none,
  view     = {0}{90},
  domain   = -1:1,
  y domain = -1:1,
  samples  = 21,
  xmax     = 1,
  ymax     = 1
  ]
  \draw (axis cs:1.25,1.25) circle [blue, radius=0.3];
  \addplot3 [blue, quiver={u={(x)/(x^2+y^2)}, v={(y)/(x^2+y^2)}, scale 
   arrows=0.04},samples=8,->] (x,y,0);
\draw (axis cs:0,0) node [above] {$z_0$};
\filldraw(axis cs: 0,0)circle(1pt); 

\end{axis}

\end{tikzpicture}
\caption{Sink and source centred around $z_0$.}

\end{figure}

答案1

问题来自于xmaxymax,它们会剪掉过冲矢量。

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
 \begin{tikzpicture}
 \begin{axis}[
     ticks=none,
    view     = {0}{90},
  domain   = -1:1,
  y domain = -1:1,
  samples  = 21,
%   xmax     = 1,
%   ymax     = 1
]
\addplot3 [blue, quiver={u={-(x)/(x^2+y^2)}, v={-(y)/(x^2+y^2)}, scale 
arrows=0.04},samples=8,->] (x,y,0);
\draw (axis cs:0,0) node [above] {$z_0$};
\filldraw(axis cs: 0,0)circle(1pt); 

\end{axis}
\begin{axis}[ xshift=8cm,
ticks=none,
  view     = {0}{90},
  domain   = -1:1,
  y domain = -1:1,
  samples  = 21,
%   xmax     = 1,
%   ymax     = 1,
  ]
  %\draw (axis cs:1.25,1.25) circle [blue, radius=0.3];

  \addplot3 [blue, quiver={u={(x)/(x^2+y^2)}, v={(y)/(x^2+y^2)}, scale 
   arrows=0.04},samples=8,->] (x,y,0);
\draw (axis cs:0,0) node [above] {$z_0$};
\filldraw(axis cs: 0,0)circle(1pt); 

\end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容