function plot_yaw_histogram(case_ids, controller_ids, cases,dir)
dir = interp1(dir(:,1), dir(:,2), cases.t);


for iC = 1:length(case_ids)
    %data_yaw = zeros(length(cases.t), length(controller_ids));

    
    % for iiC = 1:length(controller_ids)
    %     data_yaw(:,iiC) = reshape(dir' - cases.yaw_ori{case_ids(iC), controller_ids(iiC)}, [], 1);
    % end
    
    figure
    hold on
    for iiC = 1:length(controller_ids)
        %data_yaw(:,iiC) = reshape(dir' - cases.yaw_ori{case_ids(iC), controller_ids(iiC)}, [], 1);

        % histogram( ...
        %     abs(reshape(dir' - cases.yaw_ori{case_ids(iC), controller_ids(iiC)}, [], 1)), ...
        %     -0.5:1:30.5,"DisplayStyle","stairs", ...
        %     'EdgeColor',cases.colors(controller_ids(iiC),:), ...
        %     'LineStyle', cases.line{controller_ids(iiC)}, ...
        %     'Normalization','cdf')

        histogram( ...
            abs(reshape(dir' - cases.yaw_ori{case_ids(iC), controller_ids(iiC)}, [], 1)), ...
            -0.0:5:30.0,"DisplayStyle","stairs", ...
            'EdgeColor',cases.colors(controller_ids(iiC),:), ...
            'LineStyle', cases.line{controller_ids(iiC)}, ...
            'Normalization','cdf')
        
        % plot(dir' - cases.yaw_ori{case_ids(iC), controller_ids(iiC)}(:,iT),...
        %     cases.t, 'LineWidth',1, ...
        %     'Color',cases.colors(controller_ids(iiC),:), ...
        %     'LineStyle',cases.line{controller_ids(iiC)})
    end
    grid on
    legend(cases.names(controller_ids),'Location','best')
    %plot(dir(:,2), dir(:,1), ':k', 'LineWidth', 2)
    ylabel('CDF')
    xlabel('Abs yaw misalignment [deg]')
    title([cases.case_names{case_ids(iC)}])
end
end