function poor_mans_waterfall(data_array,current_expt,figure_addon,title_string,zlim_trough,color_array_rows,minutes_per_trial)
%called by careful_asynch_measurer and careful_charge_calculator
%data_array should have trials as columns

num_samples_per_event=size(data_array,1);
startpoint=1;
num_trials=size(data_array,2);
% clr=colormap(jet(color_array_size));
colormap(jet)
azimuth_elevation=[-21.5 25.5];

figure(figure_addon+current_expt),hold on

waterfall(repmat([1:num_samples_per_event],num_trials,1),repmat([1:num_trials]',1,num_samples_per_event),fliplr(-1*data_array(startpoint:startpoint+num_samples_per_event-1,:)'),...
    repmat(color_array_rows,1,num_samples_per_event))

ylim([-1*ceil(num_trials/4) num_trials]),ylimrange=ylim;
if ylimrange(2)*minutes_per_trial<10,ytix=[0 5*inv(minutes_per_trial):5*inv(minutes_per_trial):ylimrange(2)];
elseif ylimrange(2)*minutes_per_trial<20,ytix=[0 10*inv(minutes_per_trial):10*inv(minutes_per_trial):ylimrange(2)];
else ytix=[0 20*inv(minutes_per_trial):20*inv(minutes_per_trial):ylimrange(2)];
end
set(gca,'ytick',ytix)
triallabels=str2num(get(gca,'yticklabel'));
set(gca,'yticklabel',triallabels*minutes_per_trial)
ylabel('Time (min)')

xlim([0 num_samples_per_event])
xtixrange=range(xlim)/100;
if xtixrange<3,xtix=[0 50:50:num_samples_per_event];
elseif xtixrange<6,xtix=[0 100:100:num_samples_per_event];
else xtix=[0 200:200:num_samples_per_event];
end
set(gca,'xtick',xtix)
set(gca,'xticklabel',fliplr(xtix/10))
xlabel('Time (ms)')

zlim([-15 ceil(-1.25*zlim_trough)])%zlim([ceil(zlim_trough/6) ceil(-1.25*zlim_trough)])
ztixrange=range(zlim)/10;
if ztixrange<5,ztix=[0 10:10:ceil(-1.25*zlim_trough)];
elseif ztixrange<10,ztix=[0 20:20:ceil(-1.25*zlim_trough)];
else ztix=[0 30:30:ceil(-1.25*zlim_trough)];
end
set(gca,'ztick',ztix)
zlabel('I_m_e_m (pA)')

view(azimuth_elevation(1),azimuth_elevation(2))
set(gca,'projection','orthographic')
set(gcf,'renderer','painters')
title(strcat(title_string,',','experiment#',num2str(current_expt)))

%other methods were attempted in effort to work around the bug where the 'painters' renderer draws 3D plot elements in incorrect order placing in front elements supposed to be in back
%this code does the waterfall routine trial by trial, but in the end the plot is still drawn by painters so the ordering problem still persists
% num_trials=size(data_array,2)
% for trial=num_trials:-1:1
%     x=[1:datalength_to_use];
%     y=[repmat(trial,datalength_to_use,1)];
%     z=-1*data_array(startpoint:startpoint+datalength_to_use-1,trial)';
%     c=repmat(trial,datalength_to_use,1)';
%     
% 	c0 = (max(max(c))+min(min(c)))/2;
% 	z0 = min(z);
% 	
%     x=[1 1 x datalength_to_use*[1 1 1]]';
%     y=[trial;trial;y;trial*[1;1;1]];
%     z = [z0 z(1) z z(end) z0 z0 ];
%     z=fliplr(z);
%     c = [c0 c0  c c0 c0 NaN];
%     
% 	fc = get(gca,'color');
% 	if strcmp(fc,'none'), fc = get(gcf,'color'); end
% 	hp = patch(x',y',z,c,'facecolor',fc,'edgecolor','flat');
%     %drawnow
%     hold on
% %	view(26,26)
% %     axis off
% end
% %-----
% % figure(2),hold on
% % for trial=1:size(data_array,2)
% %     plot3([1:datalength_to_use],repmat(trial*.1,1,datalength_to_use),-1*data_array(startpoint:startpoint+datalength_to_use-1,(trial)),'color',clr(trial,:),'linewidth',.5)
% % end
% % zlim([-5 60])
% % xlabel('x'),ylabel('y')
% % view(viewmat(1),viewmat(2))
% set(gca,'projection','perspective')
% % axis off