function histogram_display ( input_file_name ) %% HISTOGRAM_DISPLAY makes a stacked bar plot of a set of histogrammed data. % % Discussion: % % The input data is a single file, whose first column is taken as a set of % average X values. % % Each subsequent column is taken as the corresponding Y coordinates of % a histogram. All the columns are plotted together as a stacked bar plot. % % Modified: % % 08 November 2005 % % Author: % % John Burkardt % % Parameters: % % Input, string INPUT_FILE_NAME, the name of the input data file. % % Local parameters: % % Local, integer M, the number of columns of data. % % Local, integer N, the number of entries in each column. % % Local, real Z(NDIM,N), the set of data. % fprintf ( 1, '\n' ); timestamp; fprintf ( 1, '\n' ); fprintf ( 1, 'HISTOGRAM_DISPLAY:\n' ); fprintf ( 1, ' MATLAB version:\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read columns of data, assuming column 1 is the.\n' ); fprintf ( 1, ' (average) X value, the other columns are histograms.\n' ); fprintf ( 1, ' Display a stacked histogram of all the data.\n' ); if ( s_len_trim ( input_file_name ) <= 0 ) fprintf ( 1, '\n' ); input_file_name = input ( 'Enter the name of the input file.' ); end [ m, n ] = dtable_header_read ( input_file_name ); % % M had better be at least 2! % if ( m < 2 ) fprintf ( 1, '\n' ); fprintf ( 1, 'HISTOGRAM_DISPLAY - Fatal error!\n' ); fprintf ( 1, ' The number of columns of data must be at least 2!\n' ); error ( 'HISTOGRAM_DISPLAY - Fatal error!' ); end % % Read the point set. % z = dtable_data_read ( input_file_name, m, n ); z = z'; % % Assume that column 1 is the (average) X coordinate, and that all other columns % are sets of Y coordinates. Plot the Y values as stacked bars. % title ( input_file_name ); bar3 ( z(:,1), z(:,2:m), 'stacked' ); fprintf ( 1, '\n' ); fprintf ( 1, 'HISTOGRAM_DISPLAY:\n' ); fprintf ( 1, ' Normal end of execution.\n' ); fprintf ( 1, '\n' ); timestamp;