image thumbnail
from plot manipulator by Stephen Faul
Plot manipulation for multiple data vectors.

plotmanipulator(varargin)
function fig = plotmanipulator(varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Author: Stephen Faul
% Date: 14th Oct 2005
% Description: Take pairs of xdata, ydata and plot within a window
%               which allows interactive manipulation of zoom
%               and focus. 8 linestyles are repeated over and over.
%               This file is an altered version of the 
%               original from Greg Siegle.
%
% Usage: plotmanipulator(x1,y1,x2,y2,x3,y3....)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
plot_styles={'-.g','-b','--r',':g','-.m','-r','--b',':m'};

mat0 =[  0         0    0.5625
         0         0    0.6250
         0         0    0.6875
         0         0    0.7500
         0         0    0.8125
         0         0    0.8750
         0         0    0.9375
         0         0    1.0000
         0    0.0625    1.0000
         0    0.1250    1.0000
         0    0.1875    1.0000
         0    0.2500    1.0000
         0    0.3125    1.0000
         0    0.3750    1.0000
         0    0.4375    1.0000
         0    0.5000    1.0000
         0    0.5625    1.0000
         0    0.6250    1.0000
         0    0.6875    1.0000
         0    0.7500    1.0000
         0    0.8125    1.0000
         0    0.8750    1.0000
         0    0.9375    1.0000
         0    1.0000    1.0000
    0.0625    1.0000    1.0000
    0.1250    1.0000    0.9375
    0.1875    1.0000    0.8750
    0.2500    1.0000    0.8125
    0.3125    1.0000    0.7500
    0.3750    1.0000    0.6875
    0.4375    1.0000    0.6250
    0.5000    1.0000    0.5625
    0.5625    1.0000    0.5000
    0.6250    1.0000    0.4375
    0.6875    1.0000    0.3750
    0.7500    1.0000    0.3125
    0.8125    1.0000    0.2500
    0.8750    1.0000    0.1875
    0.9375    1.0000    0.1250
    1.0000    1.0000    0.0625
    1.0000    1.0000         0
    1.0000    0.9375         0
    1.0000    0.8750         0
    1.0000    0.8125         0
    1.0000    0.7500         0
    1.0000    0.6875         0
    1.0000    0.6250         0
    1.0000    0.5625         0
    1.0000    0.5000         0
    1.0000    0.4375         0
    1.0000    0.3750         0
    1.0000    0.3125         0
    1.0000    0.2500         0
    1.0000    0.1875         0
    1.0000    0.1250         0
    1.0000    0.0625         0
    1.0000         0         0
    0.9375         0         0
    0.8750         0         0
    0.8125         0         0
    0.7500         0         0
    0.6875         0         0
    0.6250         0         0
    0.5625         0         0];

mat1 = 'lim=get(gca,''xlim'')';

mat2 =[0         0    1.0000
         0    0.5000         0
    1.0000         0         0
         0    0.7500    0.7500
    0.7500         0    0.7500
    0.7500    0.7500         0
    0.2500    0.2500    0.2500];

mat3 =[0.6908    1.9880   17.3205];


if mod(nargin,2)~=0
    error('Please give inputs as xdata,ydata pairs.');
end
no_data=nargin/2;

if nargin < 1, fprintf(1,'Useage: plotmanipulator(matrix)\n'); return; end

h0 = figure('Color',[0.8 0.8 0.8], ...
	'Colormap',mat0, ...
	'FileName','E:\greg\pitt\stulab\eegsys-processing\plotmanipulator.m', ...
	'PaperPosition',[18 180 576 432], ...
	'PaperUnits','points', ...
	'Position',[240 202 560 420], ...
	'Tag','Fig2', ...
	'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'ListboxTop',0, ...
	'Position',[161.25 285.75 92.25 17.25], ...
	'String','Data plot manipulator', ...
	'Style','text', ...
	'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'Callback','zoomslider', ...
	'ListboxTop',0, ...
	'Position',[39.75 42.75 153 17.25], ...
	'Style','slider', ...
        'Value',0.5, ...
	'Tag','RegionSlider');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'ListboxTop',0, ...
	'Callback','zoomslider', ...
	'Position',[228 39.75 155.25 21.75], ...
	'Style','slider', ...
        'Value',1, ...
	'Tag','ZoomSlider');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'ListboxTop',0, ...
	'Position',[69.75 22.5 102.75 14.25], ...
	'String','region', ...
	'Style','text', ...
	'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
	'Units','points', ...
	'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ...
	'ListboxTop',0, ...
	'Position',[255.75 15 98.25 18], ...
	'String','zoom', ...
	'Style','text', ...
	'Tag','StaticText3');
h1 = axes('Parent',h0, ...
	'Units','pixels', ...
	'Box','on', ...
	'CameraUpVector',[0 1 0], ...
	'Color',[1 1 1], ...
	'ColorOrder',mat2, ...
	'Position',[50 126 470 250], ...
	'XColor',[0 0 0], ...
	'YColor',[0 0 0], ...
	'ZColor',[0 0 0]);
h2 = line('Parent',h1, ...
	'Color',[0 0 1], ...
	'Tag','Line1', ...
	'XData',[1 2 3 4 5 6], ...
	'YData',[1 2 3 3 2 1]);
h2 = text('Parent',h1, ...
	'Color',[0 0 0], ...
	'HandleVisibility','off', ...
	'HorizontalAlignment','center', ...
	'Position',[3.494669509594882 0.8072289156626504 17.32050807568877], ...
	'Tag','Text4', ...
	'VerticalAlignment','cap');
set(get(h2,'Parent'),'XLabel',h2);
h2 = text('Parent',h1, ...
	'Color',[0 0 0], ...
	'HandleVisibility','off', ...
	'HorizontalAlignment','center', ...
	'Position',mat3, ...
	'Rotation',90, ...
	'Tag','Text3', ...
	'VerticalAlignment','baseline');
set(get(h2,'Parent'),'YLabel',h2);
h2 = text('Parent',h1, ...
	'Color',[0 0 0], ...
	'HandleVisibility','off', ...
	'HorizontalAlignment','right', ...
	'Position',[0.466950959488273 3.353413654618473 17.32050807568877], ...
	'Tag','Text2', ...
	'Visible','off');
set(get(h2,'Parent'),'ZLabel',h2);
h2 = text('Parent',h1, ...
	'Color',[0 0 0], ...
	'HandleVisibility','off', ...
	'HorizontalAlignment','center', ...
	'Position',[3.494669509594882 3.056224899598393 17.32050807568877], ...
	'Tag','Text1', ...
	'VerticalAlignment','bottom');
set(get(h2,'Parent'),'Title',h2);
if nargout > 0, fig = h0; 
    clear;
    load 'temp_workspace_save'; 
end
axes(gca)
plot(varargin{1},varargin{2});hold on;
for i=2:no_data
    plot(varargin{i*2-1},varargin{i*2},plot_styles{mod(i-1,8)+2});
end
axis tight
set(gcf,'UserData',axis);
clear;

Contact us at files@mathworks.com