//  [python]
def plot_end_use_totals_by_building_type(self, df, column_for_grouping, color_map, output_dir):
        # Summarize end use energy totals by building type

        # End uses to include
        end_use_cols = self.COLS_ENDUSE_ANN_ENGY
        wtd_end_use_cols = [self.col_name_to_weighted(c, 'tbtu') for c in end_use_cols]

        # Disaggregate to these levels
        group_bys = [
            # None,
            self.CEN_DIV,
            # self.FLR_AREA_CAT, TODO reenable after adding to both CBECS and ComStock
            # self.VINTAGE,
        ]

        # How the data will be combined
        agg_method = np.sum  # Could use np.mean etc. for different look at data

        # Extract the units from the name of the first column
        units = self.nice_units(self.units_from_col_name(wtd_end_use_cols[0]))

        for bldg_type, bldg_type_df in df.groupby(self.BLDG_TYPE):
            for group_by in group_bys:
                var_name = 'End Use'
                val_name = f'Energy Consumption ({units})'
                tots_long = pd.melt(
                    bldg_type_df,
                    id_vars=[
                        column_for_grouping,
                        group_by
                    ],
                    value_vars=wtd_end_use_cols,
                    var_name=var_name,
                    value_name=val_name
                )
                # logger.debug(tots_long)

                g = sns.factorplot(
                    data=tots_long,
                    x=group_by,
                    y=val_name,
                    row=var_name,
                    hue=column_for_grouping,
                    estimator=agg_method,
                    order=self.ORDERED_CATEGORIES[group_by],
                    hue_order=list(color_map.keys()),
                    palette=color_map.values(),
                    sharex=False,
                    kind='bar',
                    size=6,
                    aspect=3
                )
                g._legend.set_title(self.col_name_to_nice_name(column_for_grouping))

                fig = g.fig

                # Titles and axis labels

                # Formatting
                gb = self.col_name_to_nice_name(group_by)
                title = f"End Use Energy Consumption \n for {bldg_type.replace('_', ' ')} by {f'{gb}'}".title()
                for ax in g.axes.flatten():
                    # Improve the title and move to the y-axis label
                    ax_title = ax.get_title()
                    ax_title = ax_title.replace(f'{var_name} = ', '')
                    ax_units = self.units_from_col_name(ax_title)
                    ax_title = self.col_name_to_nice_name(ax_title)
                    ax_title = ax_title.replace('Energy Consumption', f'({ax_units})')
                    ax_title = ax_title.replace(' ', '\n')
                    ax.set_ylabel(ax_title, rotation=0, ha='right')
                    ax.set_title('')
                ax.set_xlabel(gb)

                g.tight_layout()

                # Save figure
                title = title.replace('\n', '')
                fig_name = f'{title.replace(" ", "_").lower()}.{self.image_type}'
                fig_sub_dir = os.path.abspath(os.path.join(output_dir, bldg_type))
                if not os.path.exists(fig_sub_dir):
                    os.makedirs(fig_sub_dir)
                fig_path = os.path.abspath(os.path.join(fig_sub_dir, fig_name))
                plt.savefig(fig_path, bbox_inches = 'tight')
                plt.close()