function data = analysis_rose(data)

feature_error{360} = [];

freq_reports= 0;

count = 0;

for trial = 1:size(data,1)
    for token = 1:size(data,2)
        
        
        count = count +1;
        deg_prez = round(rad2deg(data(trial,token).target_radians));
        freq_reports(count) = data(trial,token).retrieved_location;
        
        feature_error{deg_prez} = [feature_error{deg_prez} data(trial,token).raw_deviation];
        
    end
end


load colorwheel360.mat

for banana = 1:360
    fe(banana) = std(rad2deg(feature_error{banana}));
end

fe = round(fe);

rose_count = 0;
for whichrads = 1:length(fe)
    if isnan(fe(whichrads))==0
        for howmany = 1:fe(whichrads)
            rose_count = rose_count + 1;
            a(rose_count) = deg2rad(whichrads);
        end
    end
end

color = flipud((fullcolormatrix)./250);

bins = 360;


for i = 1:2
    figure
    
    if i == 1
        whichreports = (2*pi)+(-1*freq_reports);
    elseif i == 2
        whichreports = (2*pi)+(-1*a);
    end
    
    rose_plot = rose(whichreports,bins);
    
    x = get(rose_plot, 'XData') ;
    y = get(rose_plot, 'YData') ;
    
    color_dist = (size(color,1))/bins;
    
    count = 0;
    for i = 1:bins
        count = count +1;
        if count == 1
            patch(x(1:i*4),y(1:i*4),mean(color(1:i*color_dist,:)));
        else
            patch(x((i-1)*4:i*4),y((i-1)*4:i*4),mean(color(((i-1)*color_dist):(i*color_dist),:)));
        end
        
    end
end

keyboard

end