[sample_bin, quit] = drawFunc_bar(window, resp_input_vec, draw_args, trial_bin, sample_bin)
DRAWFUNC_BAR is an example of a simple draw func for use with easyScale. It generates a series of bars of various colours (with the number of bars determined by the dimensionality of the input).
The current draw_func takes the standard form required by easyScale, and is designed to be flexible, taking many different parameters via draw_args. A simpler version could have been created in which these settings were hard-coded. However, this illustrates how parameters via draw_args can be included to help make your code more reusable. The parameters that are fed to this function by easyScale are as follows: window: token for the window where the bar plot should be drawn. resp_input_vec: timeseries object with recent history of responses (with arbitrary dimensionality of [n m], where n is any number of samples and m is any number of dimensions). Note, however, that only the most recent sample (i.e., the bottom one) is used for drawing the bar plots. draw_args: parameters set by the calling experiment used to control the behaviour of this draw_func. 1: bar_lims: a two-element numeric array to set the bounds of all bars [lower_limit upper_limit]. 2: x_axis_name: a string to label the x-axis. 3: y_axis_name: a string to label the y-axis. 4: x_axis_labels: a string to label each bar/dimension of the x-axis. 5: bar_cols: a cell array of colors for the bars in the graph with m elements, each corresponding to a string or three-element numeric array describing a color recognized by matlab. 6: origin: a two-element numeric array describing the [x y] screen coordinates where the x and y axes should begin. 7: plot_size: a two-element numeric array [x_height y_height] to determine the size of the plot. 8: axis_col: a string or three-element array describing the axis color. 9: text_margin: a scalar describing the margin to be left between the axes and text labels. 10: bar_margin: a scalar describing the gap to be left between bars. trial_bin: ignored sample_bin: ignored DRAWFUNC_BAR also returns sample_bin and quit as output, because these are required by easyScale; however, these are not used in the function. sample_bin is simply returned as it was provided in the input_args, and quit is a boolean that is always false. You could, of course, modify the function to send a quit request to easyScale using this parameter once a certain configuration of bar heights was obtained.
For example usage of DRAWFUNC_BAR, please see demoEasyScale_bar.