function rectangles_with_error_bars(y_positions, upper_error_bars, lower_error_bars, color_array, plot_each_value, each_value_cell)
%description: for y-position and the upper and lower error bars,  each column is an individual, and each row is a condition
 %for example, to plot the average consumption by matthew, mark, luke and john over three meals, then, in a separate cluster of bars, average over three meals the next day, the first input matrix would be [mattmeanday1 markmeanday1 lukemeanday1 johnmeanday1; mattmanday2 markmeanday2 lukemeanday2 johnmeanday2] 
 %color_array is 3 rows (r,g,b) by the number of individuals (i.e., columns) in the other matrices
%called by: analyze_release_dependence, change_point_data_plotter, convert_stored_matrix, latency_summarizer, plot_mean_raw_traces(deprecated), short_term_dynamics_oct2007(deprecated) 
%calls: [no custom functions]
%notes:
%code confirmed date: oct 9, 2009

rectangle_width=.1;
rectangle_linewidth=5;
fill_rectangles=0;
error_linewidth=5;
tops_on_error_bars=1;
    top_width=.025; %actual width will be double this

num_conditions=size(y_positions,1);
num_individuals=size(y_positions,2);
    
hold on
for condition=1:num_conditions
    condition_x_offset=2*(condition-1)*(rectangle_width*num_individuals);
    for individual=1:num_individuals
        if y_positions(condition,individual)>0,rectangle_bottom=0;rectangle_height=y_positions(condition,individual);else rectangle_bottom=y_positions(condition,individual);rectangle_height=-1*rectangle_bottom;end
        if fill_rectangles
            rectangle('position',[condition_x_offset+(individual-1)*rectangle_width rectangle_bottom rectangle_width rectangle_height],'linewidth',rectangle_linewidth,'facecolor',color_array(:,individual)','edgecolor',color_array(:,individual)')
        else
            rectangle('position',[condition_x_offset+(individual-1)*rectangle_width rectangle_bottom rectangle_width rectangle_height],'linewidth',rectangle_linewidth,'edgecolor',color_array(:,individual)')
        end
        x_for_errorbar=condition_x_offset+(individual-1)*rectangle_width+.5*rectangle_width;
        plot([x_for_errorbar x_for_errorbar],[lower_error_bars(condition,individual) upper_error_bars(condition,individual)],'linewidth',error_linewidth,'color',color_array(:,individual)')
        if tops_on_error_bars
            plot([x_for_errorbar-top_width x_for_errorbar+top_width],[upper_error_bars(condition,individual) upper_error_bars(condition,individual)],'linewidth',error_linewidth,'color',color_array(:,individual)')
        end
        if plot_each_value
            for single_val=1:length(each_value_cell{condition,individual})
                rand_offset=rand*.025+.005;
                plot(x_for_errorbar+rand_offset,each_value_cell{condition,individual}(single_val),'o','markeredgecolor',color_array(:,individual),'linewidth',2)
            end
        end
    end
end
%set(gca,'xtick',[])