Commit a5e77167 authored by Jesse Heckman's avatar Jesse Heckman

update draft statemachine movesound

parent dac14a84
......@@ -38,48 +38,53 @@ function draft(obj)
%% Create (sub)plots
% Draft each subplot
for iObj = 1:numel(obj)
iAx = pb_invidx([dsz(1), dsz(2)],iObj);
% Make axes
ax(iAx) = subplot(dsz(1),dsz(2),iObj);
if obj(iAx).pva.subtitle; title(obj(iAx).pva.subtitle); end
axis(obj(iAx).pva.axis);
hold on;
% Set colors
nCol = 1;
if ~obj(iObj).pva.continious
nCol = length(unique(obj(iObj).pva.color));
end
% Select compare axis.
objsz = numel(obj);
cmpsz = 1;
tmpV = [];
if isfield(obj(1).pva,'axcomp'); tmpV = obj(1).pva.axcomp; end
if ~isempty(tmpV) && objsz == 1; cmpsz = length(unique(tmpV.feature)); end
for iCmp = 1:cmpsz
% FIX COLOR REPEAT ONLY FOR COLOR SPLITTING DATA
colors = pb_selectcolor(nCol,obj(iAx).pva.def);
uD = unique(obj(iAx).pva.color);
for iCol = 1:nCol
d = obj(iAx).pva;
d.ind = d.color == uD(iCol);
d.color = colors(iCol,:);
end
% Make Compare Axes
% // NOTE THAT THIS IS VERY INEFFICIENT: DO 1) MAKE AXCMP DEFAULT 1
r = 1;
c = 1;
ax(iCmp) = subplot(r,c,iCmp);
% Plot all graphs
for iDP = 1:length(obj(iObj).dplot)
d = obj(iAx).pva;
obj(iObj).dplot{iDP}(obj,d);
for iObj = 1:objsz
% Make Axes
iAx = pb_invidx([dsz(1), dsz(2)],iObj);
ax(iAx) = subplot(dsz(1),dsz(2),iObj);
if obj(iAx).pva.subtitle; title(obj(iAx).pva.subtitle); end
axis(obj(iAx).pva.axis);
hold on;
% Set colors
nCol = 1;
if ~obj(iObj).pva.continious
nCol = length(unique(obj(iObj).pva.color));
end
% Plot all graphs
for iDP = 1:length(obj(iObj).dplot)
d = obj(iAx).pva;
obj(iObj).dplot{iDP}(obj,d);
end
% Set labels
if ~obj(1).labels.supx; xlabel(obj(iAx).labels.xlab); end
if ~obj(1).labels.supy; ylabel(obj(iAx).labels.ylab); end
% Make scientific notations on the axes.
ax(iAx).YAxis.Exponent = length(num2str(max(abs(round(ax(iAx).YLim)))))-1;
ax(iAx).XAxis.Exponent = length(num2str(max(abs(round(ax(iAx).XLim)))))-1;
end
% Set labels
if ~obj(1).labels.supx; xlabel(obj(iAx).labels.xlab); end
if ~obj(1).labels.supy; ylabel(obj(iAx).labels.ylab); end
% Make scientific notations on the axes.
ax(iAx).YAxis.Exponent = length(num2str(max(abs(round(ax(iAx).YLim)))))-1;
ax(iAx).XAxis.Exponent = length(num2str(max(abs(round(ax(iAx).XLim)))))-1;
end
%% Adjust axis handles
% Set super labels
......@@ -98,3 +103,15 @@ end
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % FIX COLOR REPEAT ONLY FOR COLOR SPLITTING DATA
% colors = pb_selectcolor(nCol,obj(iAx).pva.def);
% uD = unique(obj(iAx).pva.color);
% for iCol = 1:nCol
% d = obj(iAx).pva;
% d.ind = d.color == uD(iCol);
% d.color = colors(iCol,:);
% end
......@@ -20,7 +20,7 @@ classdef pb_draft < matlab.mixin.Copyable
end
% Set protected properties
properties (Access=protected,Hidden=true)
properties (Access = protected, Hidden = true)
parent = [];
pva;
......@@ -44,28 +44,34 @@ classdef pb_draft < matlab.mixin.Copyable
% Constructor function
function obj = pb_draft(varargin)
% read and parse varargin
parse_va(obj,varargin{:});
parse_va(obj,varargin{:}); % read parse keys
end
set_title(obj,title,varargin);
set_legend(obj,varargin);
set_labels(obj,varargin);
set_grid(obj,varargin);
% Set functions
set_title(obj,title,varargin); % set title
set_legend(obj,varargin); % set legend /// NOT YET DONE
set_labels(obj,varargin); % set labels
set_grid(obj,varargin); % set grid
set_axcomp(obj,feature,varargin); % set comparision axe /// WORKING ON IT
% Plot functions
plot_rawdata(obj,varargin); % plot the rawdata
plot_hline(obj,varargin); % plot horizontal lines
plot_vline(obj,varargin); % plot vertical lines
plot_dline(obj,varargin); % plot diagonal lines
plot_bubble(obj,varargin); % plot bubblr histoplot
plot_bubble(obj,varargin); % plot bubble histoplot
stat_regres(obj,varargin); % transform regression
% Statistical functions
stat_regres(obj,varargin); % transform regression // NOT YET DONE
stat_probit(obj,varargin); % transform probit
% Fitting functions
fit_ellipse(obj,varargin); % make ellipse fit
fit_sigmoid(obj,varargin); % make sigmoidal fit
fit_polyn(obj,varargin); % make polynomial fit
draft(obj); % make plot
% Core functions
draft(obj); % draw figure
print(obj,varargin); % make file
function obj = set_parent(obj,parent)
......
function set_axcomp(obj,parameter,varargin)
% PB_DRAFT>SET_AXCOMP
%
% SET_AXCOMP(obj,row,col,varargin) creates subplots that compare over a
% selected parameter.
%
% See also PB_DRAFT
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
if nargin <2 || isempty(parameter); return; end
v = varargin;
orient = pb_keyval('orientation',v,'horizontal');
f.prefix = pb_keyval('prefix',v);
f.feature = parameter;
n = length(unique(parameter));
if strcmp('horizontal',orient); f.r = 1; f.c = n; else; f.r = n; f.c = 1; end
obj(1).pva.axcomp = f;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% p=inputParser;
% my_addParameter(p,'scale','fixed'); %options 'free' 'free_x' 'free_y' 'independent'
% my_addParameter(p,'space','fixed'); %'free_x','free_y','free'
% my_addParameter(p,'force_ticks',false);
% my_addParameter(p,'column_labels',true);
% my_addParameter(p,'row_labels',true);
% parse(p,varargin{:});
%
% obj.facet_scale=p.Results.scale;
% obj.facet_space=p.Results.space;
% obj.column_labels=p.Results.column_labels;
% obj.row_labels=p.Results.row_labels;
%
% if strcmp(obj.facet_scale,'independent') %Force ticks by default in that case
% obj.force_ticks=true;
% else
% obj.force_ticks=p.Results.force_ticks;
% end
%
% %Handle case where facet_grid is called after update()
% if obj.updater.updated
% if isnumeric(obj.aes.row) && isnumeric(obj.aes.column) && all(obj.aes.row==1) && all(obj.aes.column==1)
% if isempty(obj.aes.row) && isempty(obj.aes.column)
% %User probably tried to update all the data
% obj.updater.facet_updated=0;
% else
% %We go from one to multiple facets
% obj.updater.facet_updated=1;
% end
% else
% if isempty(row) && isempty(col)
% %We go from multiple to one facet
% obj.updater.facet_updated=-1;
% else
% error('Updating facet only works when going from one to multiple facets or vice versa');
% end
% end
% end
%
% obj.aes.row=shiftdim(row);
% obj.aes.column=shiftdim(col);
%
% obj.wrap_ncols=-1;
% end
\ No newline at end of file
......@@ -2,14 +2,13 @@
pb_clean;
load('exD_saccade');
cfn = pb_newfig(0,'size',[0 0 17 17],'resize','off');
%% first figure draft
%%
cfn = pb_newfig(0,'size',[0 0 17 17],'resize','off');
% construct
for i = 1:2
for j = 1:2
d(j,i) = pb_draft('x',Saccades.GazeLatency*1000,'y',Saccades.HeadLatency*1000,'color',Saccades.Modality,'subtitle',['s00' num2str(j)]);
d(j,i) = pb_draft('x',Saccades.GazeLatency,'y',Saccades.HeadLatency,'color',Saccades.Modality,'subtitle',['s00' num2str(j)]);
d(j,i).set_labels('x','Gaze Latency (ms)','y','Head Latency (ms)');
if ~iseven(j)
d(j,i).plot_rawdata;
......@@ -26,4 +25,11 @@ end
d.set_title('Saccade Latencies');
d.draft;
d.print('disp',true);
%d.print('disp',true);
%% second figure draft
cfn = pb_newfig(cfn,'size',[0 0 17 17],'resize','off');
d = pb_draft('x',Saccades.GazeLatency,'y',Saccades.HeadLatency,'color',Saccades.Modality);
d.set_axcomp([1:2]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment