Edit and compile if you like:
% Author: Izaak Neutelings (July 2018)% page 8 https://archive.org/details/StaticAndDynamicElectricity% https://tex.stackexchange.com/questions/56353/extract-x-y-coordinate-of-an-arbitrary-point-on-curve-in-tikz% https://tex.stackexchange.com/questions/412899/tikz-calculate-and-store-the-euclidian-distance-between-two-coordinates\documentclass[border=3pt,tikz]{standalone}\usepackage{amsmath} % for \dfrac\usepackage{bm}\usepackage{physics}\usepackage{tikz,pgfplots}\usetikzlibrary{angles,quotes} % for pic (angle labels)\usetikzlibrary{calc}\usetikzlibrary{decorations.markings}\tikzset{>=latex} % for LaTeX arrow head\usepackage{xcolor}\colorlet{Ecol}{orange!90!black}\colorlet{EcolFL}{orange!80!black}\colorlet{veccol}{green!45!black}\colorlet{EFcol}{red!60!black}\tikzstyle{charged}=[top color=blue!20,bottom color=blue!40,shading angle=10]\tikzstyle{darkcharged}=[very thin,top color=blue!60,bottom color=blue!80,shading angle=10]\tikzstyle{charge+}=[very thin,top color=red!80,bottom color=red!80!black,shading angle=-5]\tikzstyle{charge-}=[very thin,top color=blue!50,bottom color=blue!70!white!90!black,shading angle=10]\tikzstyle{gauss surf}=[green!40!black,top color=green!2,bottom color=green!80!black!70,shading angle=5,fill opacity=0.5]\tikzstyle{gauss lid}=[gauss surf,middle color=green!80!black!20,shading angle=40,fill opacity=0.6]\tikzstyle{gauss dark}=[green!50!black,fill=green!60!black!70,fill opacity=0.8]\tikzstyle{gauss line}=[green!40!black]\tikzstyle{gauss dashed line}=[green!60!black!80,dashed,line width=0.2]\tikzstyle{EField}=[->,thick,Ecol]\tikzstyle{vector}=[->,thick,veccol]\tikzstyle{normalvec}=[->,thick,blue!80!black!80]\tikzstyle{EFieldLine}=[thick,EcolFL,decoration={markings,mark=at position 0.5 with {\arrow{latex}}},postaction={decorate}]\tikzstyle{measure}=[fill=white,midway,outer sep=2]\def\L{8}\def\W{0.25}\def\N{14}\begin{document}
Click to download: electric_field_rod.tex • electric_field_rod.pdf
Open in Overleaf: electric_field_rod.tex