function varargout = fancyplot(varargin)
% FANCYPLOT M-file for fancyplot.fig
% Author: R. S. Schestowitz, University of Manchester

gui_Singleton = 1;

gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @fancyplot_OpeningFcn, ...
                   'gui_OutputFcn',  @fancyplot_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
               
if nargin & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end

function fancyplot_OpeningFcn(hObject, eventdata, handles, varargin)

handles.output = hObject;


guidata(hObject, handles);

if strcmp(get(hObject,'Visible'),'off')
    initialize_gui(hObject, handles);
end

function varargout = fancyplot_OutputFcn(hObject, eventdata, handles)

varargout{1} = handles.output;


function initialize_gui(fig_handle, handles)

background = imread('fpbg.jpg');
axes(handles.bg);
axis off;
imshow(background,[0,255]);

axes(handles.mainaxes);
plot([0]);
hold on;
colour = [0.3,0.3,0.3];
colour_gap_inner = [0.4,0.4,0.4];
colour_gap = [0.5,0.5,0.5];
colour_gap_outer = [0.6,0.6,0.6];
load 'data.mat';
gap = mean(datavector) / 200;
plot(datavector, 'color', colour);
plot(datavector + gap , 'color', colour_gap_inner);
plot(datavector - gap , 'color', colour_gap_inner);
plot(datavector + 2 * gap , 'color', colour_gap);
plot(datavector - 2 * gap , 'color', colour_gap);
plot(datavector + 3 * gap , 'color', colour_gap_outer);
plot(datavector - 3 * gap , 'color', colour_gap_outer);
axis off;
hold off;