decadal_feedback_variations_plots.m 3.49 KB
Newer Older
Claas Faber's avatar
Claas Faber committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                           %
%    DIAGNOSE DECADAL FEEDBACK VARIATIONS   %
%    PLOTS                                  %
%                                           %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

disp('plotting feedback strength composites');

% plot all anomaly types
for anomaly_type = [-1 1]

    % assign correct anomaly type
    switch anomaly_type
        case -1
            type_string = 'negative';
        case 0
            type_string = 'full';
        case 1
            type_string = 'positive';
    end

    disp(sprintf('\t%s',type_string));

    % SET UP FIGURE
    % +++++++++++++

        hf  = figure;
        hf.Position(3) = scale_figure_width*hf.Position(3);
        hf.Position(4) = scale_figure_height*hf.Position(4);

        % axes
        hax = axes('XLim',[all_starts(1) all_starts(end)],'YLim',[0.5 12.5],...
                'YTick',1:12,'YTickLabel',{month_ids{:}},...
                'XGrid','on','Layer','top');

        font_size    = floor(hax.FontSize*scale_font_size);
        hax.FontSize = font_size;

        hold(hax,'on');
        
    % SET NEGATIVE LAGS TO NAN 
    % ++++++++++++++++++++++++
    
        is_negative_lag = (lag_variations < 0); 
    
        % correct dimensions
        if ( size(is_negative_lag,1) ~= 12 )
            is_negative_lag = is_negative_lag';
        end
        
        % pick correct feedback strengts and set negative lags to NaN 
        use_feedback                  = feedback_strengths.(type_string); 
        use_feedback(is_negative_lag) = NaN;  

    % PLOT DATA
    % +++++++++

        % checkerboard, as in the dynamics analysis
        image(all_starts,[1:12],use_feedback,...
                'CDataMapping','scaled');
        colorbar(hax);

    % HATCH SIGNIFICANCES AND NEGATIVE LAGS
    % +++++++++++++++++++++++++++++++++++++

        % hatch everything that is significant or negative lag
        for month = 1:12

            use_sigs     = squeeze(significances.(type_string)(month,:));
            use_lags     = squeeze(is_negative_lag(month,:));

            % set significance to 0 where the lags are negative
            use_sigs(use_lags) = false;

            % convert boolean significances into indices for plotting
            use_sigs = find(use_sigs);

            % plot black crosses
            plot(hax,all_starts(use_sigs),ones(1,length(use_sigs)).*month,...
                    'x','LineWidth',line_width_significance_outline,...
                    'MarkerSize',size_significance_marker+2,...
                    'Color',my_white);
            plot(hax,all_starts(use_sigs),ones(1,length(use_sigs)).*month,...
                    'x','LineWidth',line_width_significance_markers,...
                    'MarkerSize',size_significance_marker,...
                    'Color',hax.XColor);

        end

    % POLISHING AND PRINTING
    % ++++++++++++++++++++++

        xlabel(hax,'Start year');
        ylabel(hax,'Month');

        % title
        fig_title = strrep(title_dummy,'@ANOMALYTYPE@',[upper(type_string(1)) type_string(2:end)]);
        title(hax,fig_title);

        % align axes
        hax.Position = axes_position;

        % colormap and number of displayed colours
        hax.CLim = c_limits;
        colormap(use_cmap);

        % print
        fig_name = strrep(name_dummy,'@ANOMALYTYPE@',...
                [upper(type_string(1)),type_string(2:end)]);
        print(hf,res_flag,fig_name,'-dpng');
        close(hf);

% for: plot all anomaly types
end