I am using Jupyter Notebooks as a teaching tool. I would like to build up a plot over several cells, adding new elements with each cell. It does not have to be the same plot. I don't see how to do this using the matplotlib "plot" family of functions. Is this possible and can someone post an example? Thanks
I am running my notebooks through Anaconda on a Mac.
Here is one cell that builds up individual lines in the plot (calling the field_line function to actually do the calculation.
def full_fl_3D(xfoot,yfoot,zfoot,c):
fline = field_line(xfoot,yfoot,zfoot,-1.0) # calculate negative directed field line
dipole = ax.plot(fline[0],fline[1],fline[2],c)
fline = field_line(xfoot,yfoot,zfoot,1.0) # calcualte positive directed field line
dipole = ax.plot(fline[0],fline[1],fline[2],c)
This code generates the plot. I will want to add further to this without have to build the whole thing again.
%matplotlib notebook
fig = plt.figure(figsize=(8,8))
ax = plt.axes(projection='3d')
ax.set_xlim(-rmax, rmax);ax.set_ylim(-rmax, rmax);ax.set_zlim(-rmax, rmax) #set plot limits
spos = sphere(1)
ax.plot_surface(spos[0], spos[1], spos[2], color='b',alpha = 0.1)
# plot field lines starting
nmax = 4
for i in range(2,8,2):
xfoot = float(i)
# plot the day - night plane
c="c"
full_fl_3D(xfoot,0,0,c);full_fl_3D(-xfoot,0,0,c)
# plot the dawn-dusk plane
c="y"
full_fl_3D(0,xfoot,0,c); full_fl_3D(0,-xfoot,0,c);