function plot_grid2(filename)


filename_in=load(filename,'-ascii');     %take in data from output_0
%%s=importdata('filename')

x=filename_in(:,1);
y=filename_in(:,2);
z=filename_in(:,3);
vx=filename_in(:,4);
vy=filename_in(:,5);
vz=filename_in(:,6);
xo=filename_in(:,7);
yo=filename_in(:,8);
zo=filename_in(:,9);
vxo=filename_in(:,10);
vyo=filename_in(:,11);
vzo=filename_in(:,12);
n=filename_in(:,13);

focal_plane=find(n==12);
primary=find(n==1);

j=1;

for i=1: length(x)
    if n(i)==1, currz=sqrt((x(i)*x(i)+y(i)*y(i)));
    end
    if n(i)==12,
        spotx(j)=xo(i);
        spoty(j)=yo(i);
        spotc(j)=currz;
        j=j+1;
    end
end
    
figure;

%Plot each point in the vectors spotx and spoty with color based upon their
%distance away from origin when coming from above


a=min(spotc)
b=max(spotc)
cmap=colormap;

length(cmap)

for i=1: length(spotx)
    color_index=floor((spotc(i)-a)/(b-a)*63)+1;
    h=plot(spotx(i),spoty(i),'.');
    set(h,'color',cmap(color_index,:));
    %plot(spotx(i),spoty(i),'.')
    hold on;
    i=i+1;
end

colorbar;