Import the graphing module:
from visual.graph import *
Before your while loop, create graph windows and graphing curve objects for
displaying x components of momentum for the alpha particle and the gold nucleus,
and for displaying y components of momentum:
gdisplay(xtitle='Time',ytitle='Px', x=400, y=0, width=400,height=200)
alphapx=gcurve(color=color.blue)
goldpx=gcurve(color=color.yellow)
totalpx=gcurve(color=color.green)
gdisplay(xtitle='Time',ytitle='Py', x=400, y=200, width=400,height=200)
alphapy=gcurve(color=color.blue)
goldpy=gcurve(color=color.yellow)
totalpy=gcurve(color=color.green)
Modify your while loop to add a point to the gcurve objects for each increasing value of t:
t = 0
while t < 1e-20: # (or however long you decide to let the plotting continue)
..... (calculating positions
and momenta)
.....
t = t+deltat
alphapx.plot(pos=(t, alpha.p.x))
# add
similar statements for the other 5 momentum components
This will plot alpha.p.x vs. t; t will be along the horizontal axis and alpha.p.x along the vertical axis.
Additional options are detailed in the on-line help.