使用 pstricks 绘制电场

使用 pstricks 绘制电场

我希望所有费用都有相同的颜色,但对于我来说,使用此代码无法进行修改。你能帮助我吗?

这是我的代码:

\documentclass[margin=10pt]{standalone}
\usepackage{pstricks}
\usepackage{pst-electricfield}
\begin{document}
\begin{pspicture*}(-6,-6)(6,6)
\psframe*[linecolor=white!50](-6,-6)(6,6)
\psgrid[subgriddiv=0,gridcolor=gray,griddots=10]
\psElectricfield[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]},linecolor=red]
%\psEquipotential[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]},linecolor=blue](-6.1,-6.1)(6.1,6.1)
%\psEquipotential[Q={[-1 -2 2][1 2 2][-1 2 -2][1 -2 -2]},linecolor=green,linewidth=2\pslinewidth,Vmax=0,Vmin=0](-6.1,-6.1)(6.1,6.1)
\end{pspicture*}
\end{document}

我还会在我的图片中添加一个点 A(见图)。 在此处输入图片描述

答案1

这是在 .pro 文件 (PostScript) 中硬编码的。您可以在文件中修改pst-elektricfield.pro以下行:

/drawChargeCircle { % qi x y r on the stack
  0 360 arc 
  gsave 
%  0 ge {1}{0} ifelse setgray fill 
  pop 0 0 1 setrgbcolor fill
  0 setgray stroke
} def

那么电荷总是以蓝色 (RGB) 绘制。您可以将该值更改为您需要的任何值。

场线上的点可以打印\psdot[dotscale=3](-5,1.3)

相关内容