Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Jesse Heckman
pbtoolbox
Commits
f5911223
Commit
f5911223
authored
Feb 26, 2019
by
Jesse Heckman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
major update draft + graphics
parent
a5e77167
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
327 additions
and
160 deletions
+327
-160
subtools/draft/@pb_draft/draft.m
subtools/draft/@pb_draft/draft.m
+47
-46
subtools/draft/@pb_draft/draft2.m
subtools/draft/@pb_draft/draft2.m
+103
-0
subtools/draft/@pb_draft/pb_draft.m
subtools/draft/@pb_draft/pb_draft.m
+1
-0
subtools/draft/@pb_draft/plot_bubble.m
subtools/draft/@pb_draft/plot_bubble.m
+1
-1
subtools/draft/@pb_draft/plot_dline.m
subtools/draft/@pb_draft/plot_dline.m
+3
-2
subtools/draft/@pb_draft/plot_hline.m
subtools/draft/@pb_draft/plot_hline.m
+3
-2
subtools/draft/@pb_draft/plot_rawdata.m
subtools/draft/@pb_draft/plot_rawdata.m
+3
-3
subtools/draft/@pb_draft/plot_vline.m
subtools/draft/@pb_draft/plot_vline.m
+3
-2
subtools/draft/@pb_draft/print.m
subtools/draft/@pb_draft/print.m
+2
-1
subtools/draft/@pb_draft/private/make_axes.m
subtools/draft/@pb_draft/private/make_axes.m
+29
-5
subtools/draft/@pb_draft/private/make_suplabel.m
subtools/draft/@pb_draft/private/make_suplabel.m
+1
-1
subtools/draft/@pb_draft/private/parse_va.m
subtools/draft/@pb_draft/private/parse_va.m
+53
-2
subtools/draft/@pb_draft/set_axcomp.m
subtools/draft/@pb_draft/set_axcomp.m
+1
-45
subtools/draft/@pb_draft/set_grid.m
subtools/draft/@pb_draft/set_grid.m
+20
-5
subtools/draft/example_draft.m
subtools/draft/example_draft.m
+44
-28
utilities/graphics/plot/pb_dline.m
utilities/graphics/plot/pb_dline.m
+2
-10
utilities/graphics/plot/pb_hline.m
utilities/graphics/plot/pb_hline.m
+2
-2
utilities/graphics/plot/pb_vline.m
utilities/graphics/plot/pb_vline.m
+5
-5
utilities/statistics/pb_ellipse.m
utilities/statistics/pb_ellipse.m
+2
-0
utilities/statistics/pb_ellipseplot.m
utilities/statistics/pb_ellipseplot.m
+2
-0
No files found.
subtools/draft/@pb_draft/draft.m
View file @
f5911223
...
...
@@ -22,7 +22,7 @@ function draft(obj)
set
(
t
,
'FontSize'
,
20
);
ax
=
gobjects
(
0
);
dsz
=
size
(
obj
);
objsz
=
size
(
obj
);
%% Super labels
% Check if labels are the same, and prep super labels
...
...
@@ -34,35 +34,50 @@ function draft(obj)
end
obj
(
1
)
.
labels
.
supx
=
lab_x
;
obj
(
1
)
.
labels
.
supy
=
lab_y
;
%% Create (sub)plots
% Draft each subplot
% 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
%% Set Compare axis
cmp
=
length
(
unique
(
obj
(
1
)
.
pva
.
axcomp
.
feature
));
cmpsz
=
[
1
1
];
nObj
=
numel
(
obj
)
*
cmp
;
if
min
(
objsz
)
>
1
cmp
=
1
;
else
if
objsz
(
1
)
<
objsz
(
2
)
% horizontal direction
cmpsz
(
1
)
=
cmp
;
else
% vertical direction
cmpsz
(
2
)
=
cmp
;
end
end
for
iCmp
=
1
:
cmpsz
% 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
);
for
iObj
=
1
:
objsz
%% Create (sub)plots
% Draft each subplot
for
iObj
=
1
:
numel
(
obj
)
% Repeat for comparing axis
for
iCmp
=
1
:
cmp
cObj
=
(
iObj
-
1
)
*
cmp
+
iCmp
;
% Make Axes
iAx
=
pb_invidx
([
dsz
(
1
),
dsz
(
2
)],
iObj
);
ax
(
iAx
)
=
subplot
(
dsz
(
1
),
dsz
(
2
),
iObj
);
Ax
=
pb_invidx
([
objsz
(
1
)
*
cmpsz
(
1
),
objsz
(
2
)
*
cmpsz
(
2
)],
cObj
);
% reverse get axes index
Ax2Obj
=
pb_invidx
([
objsz
(
1
),
objsz
(
2
)],
iObj
);
% reverse get object index
ax
(
Ax
)
=
subplot
(
objsz
(
1
)
*
cmpsz
(
1
),
objsz
(
2
)
*
cmpsz
(
2
),
cObj
);
% make axis
if
obj
(
i
Ax
)
.
pva
.
subtitle
;
title
(
obj
(
i
Ax
)
.
pva
.
subtitle
);
end
axis
(
obj
(
i
Ax
)
.
pva
.
axis
);
if
obj
(
i
Obj
)
.
pva
.
subtitle
;
title
(
obj
(
Ax
2Obj
)
.
pva
.
subtitle
);
end
axis
(
obj
(
Ax
2Obj
)
.
pva
.
axis
);
hold
on
;
% Select data
uFeat
=
unique
(
obj
(
1
)
.
pva
.
axcomp
.
feature
);
sel
=
obj
(
1
)
.
pva
.
axcomp
.
feature
==
uFeat
(
iCmp
);
D
=
obj
(
Ax2Obj
)
.
pva
;
D
.
x
=
D
.
x
(
sel
);
D
.
y
=
D
.
y
(
sel
);
D
.
color
=
D
.
color
(
sel
);
% Set colors
nCol
=
1
;
if
~
obj
(
iObj
)
.
pva
.
continious
...
...
@@ -71,17 +86,16 @@ function draft(obj)
% Plot all graphs
for
iDP
=
1
:
length
(
obj
(
iObj
)
.
dplot
)
d
=
obj
(
iAx
)
.
pva
;
obj
(
iObj
)
.
dplot
{
iDP
}(
obj
,
d
);
obj
(
iObj
)
.
dplot
{
iDP
}(
obj
,
D
);
end
% Set labels
if
~
obj
(
1
)
.
labels
.
supx
;
xlabel
(
obj
(
i
Ax
)
.
labels
.
xlab
);
end
if
~
obj
(
1
)
.
labels
.
supy
;
ylabel
(
obj
(
i
Ax
)
.
labels
.
ylab
);
end
if
~
obj
(
1
)
.
labels
.
supx
;
xlabel
(
obj
(
Ax
2Obj
)
.
labels
.
xlab
);
end
if
~
obj
(
1
)
.
labels
.
supy
;
ylabel
(
obj
(
Ax
2Obj
)
.
labels
.
ylab
);
end
% Make scientific notations on the axes.
ax
(
i
Ax
)
.
YAxis
.
Exponent
=
length
(
num2str
(
max
(
abs
(
round
(
ax
(
i
Ax
)
.
YLim
)))))
-
1
;
ax
(
i
Ax
)
.
XAxis
.
Exponent
=
length
(
num2str
(
max
(
abs
(
round
(
ax
(
i
Ax
)
.
XLim
)))))
-
1
;
ax
(
Ax
)
.
YAxis
.
Exponent
=
length
(
num2str
(
max
(
abs
(
round
(
ax
(
Ax
)
.
YLim
)))))
-
1
;
ax
(
Ax
)
.
XAxis
.
Exponent
=
length
(
num2str
(
max
(
abs
(
round
(
ax
(
Ax
)
.
XLim
)))))
-
1
;
end
end
...
...
@@ -91,8 +105,8 @@ function draft(obj)
% TO DO:
% 1. Optionalize subplots to have squared/linked/fixed axis
% 2. Scale and move axis to make graph nice, pleasing and non-overlapping
make_axes
(
obj
,
ax
);
make_suplabel
(
obj
)
;
obj
.
make_axes
(
ax
);
obj
.
make_suplabel
;
end
...
...
@@ -101,17 +115,4 @@ end
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % 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
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\ No newline at end of file
subtools/draft/@pb_draft/draft2.m
0 → 100644
View file @
f5911223
function
draft
(
obj
)
% PB_DRAFT>DRAFT
%
% OBJ.DRAFT will draw a figure from a pb_draft-object.
%
% See also PB_DRAFT, SET_LABELS, SET_TITLE, SET_GRID, PRINT
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
%% Create figure
% Select parent/make figure
if
isempty
(
obj
(
1
)
.
parent
)
for
iObj
=
1
:
numel
(
obj
)
obj
(
iObj
)
.
parent
=
gcf
;
end
end
% Set figure settings
set
(
obj
(
1
)
.
parent
,
'color'
,
'w'
);
t
=
sgtitle
(
obj
(
1
)
.
parent
,
obj
(
1
)
.
title
);
set
(
t
,
'FontSize'
,
20
);
ax
=
gobjects
(
0
);
dsz
=
size
(
obj
);
%% Super labels
% Check if labels are the same, and prep super labels
lab_x
=
true
;
lab_y
=
true
;
for
iObj
=
1
:
numel
(
obj
)
if
~
strcmp
(
obj
(
1
)
.
labels
.
xlab
,
obj
(
iObj
)
.
labels
.
xlab
);
lab_x
=
false
;
end
if
~
strcmp
(
obj
(
1
)
.
labels
.
ylab
,
obj
(
iObj
)
.
labels
.
ylab
);
lab_y
=
false
;
end
end
obj
(
1
)
.
labels
.
supx
=
lab_x
;
obj
(
1
)
.
labels
.
supy
=
lab_y
;
%% Create (sub)plots
% Draft each subplot
% Create comparing axis
cmp
=
length
(
unique
(
obj
(
1
)
.
pva
.
axcomp
.
feature
));
if
min
(
dsz
)
>
1
cmp
=
1
;
if
dsz
(
1
)
>
dsz
(
2
)
obj
(
1
)
.
pva
.
axcomp
.
orientation
=
'vertical'
;
else
obj
(
1
)
.
pva
.
axcomp
.
orientation
=
'horizontal'
;
end
end
nObj
=
numel
(
obj
)
*
cmp
;
for
iObj
=
1
:
numel
(
obj
)
% Repeat for comparing axis
for
iCmp
=
1
:
cmp
% 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
end
%% Adjust axis handles
% Set super labels
% TO DO:
% 1. Optionalize subplots to have squared/linked/fixed axis
% 2. Scale and move axis to make graph nice, pleasing and non-overlapping
make_axes
(
obj
,
ax
);
make_suplabel
(
obj
);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\ No newline at end of file
subtools/draft/@pb_draft/pb_draft.m
View file @
f5911223
...
...
@@ -25,6 +25,7 @@ classdef pb_draft < matlab.mixin.Copyable
pva
;
labels
;
grid
;
dplot
=
{};
...
...
subtools/draft/@pb_draft/plot_bubble.m
View file @
f5911223
...
...
@@ -63,7 +63,7 @@ function h = bubble_plot(~,data,p)
x
=
x
(
sel
);
y
=
y
(
sel
);
SZ
=
ceil
(
10
0
*
M
);
SZ
=
ceil
(
5
0
*
M
);
[
~
,
~
,
idx
]
=
unique
(
M
);
col
=
statcolor
(
max
(
idx
),[],[],[],
'def'
,
p
.
def
);
C
=
col
(
idx
,:);
...
...
subtools/draft/@pb_draft/plot_dline.m
View file @
f5911223
...
...
@@ -5,9 +5,10 @@ function plot_dline(obj,varargin)
%
% See also PB_DRAFT
% PBToolbox (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
p
.
v
=
varargin
;
p
.
lim
=
[
obj
(
1
)
.
pva
.
limits
.
x
obj
(
1
)
.
pva
.
limits
.
y
];
obj
.
dplot
=
vertcat
(
obj
.
dplot
,{
@
(
dobj
,
data
)
dline
(
dobj
,
data
,
p
)});
end
...
...
@@ -17,7 +18,7 @@ function h = dline(~,~,p)
style
=
pb_keyval
(
'style'
,
p
.
v
,
'k--'
);
visibility
=
pb_keyval
(
'visibility'
,
p
.
v
,
'off'
);
h
=
pb_dline
(
'style'
,
style
,
'visibility'
,
visibility
);
h
=
pb_dline
(
'style'
,
style
,
'
lim'
,
p
.
lim
,
'
visibility'
,
visibility
);
end
...
...
subtools/draft/@pb_draft/plot_hline.m
View file @
f5911223
...
...
@@ -5,9 +5,10 @@ function plot_hline(obj,varargin)
%
% See also PB_DRAFT
% PBToolbox (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
p
.
v
=
varargin
;
p
.
lim
=
obj
(
1
)
.
pva
.
limits
.
x
;
obj
.
dplot
=
vertcat
(
obj
.
dplot
,{
@
(
dobj
,
data
)
hline
(
dobj
,
data
,
p
)});
end
...
...
@@ -28,7 +29,7 @@ function h = hline(~,data,p)
point
=
mode
(
data
.
y
);
end
end
h
=
pb_hline
(
point
,
'style'
,
style
);
h
=
pb_hline
(
point
,
'
lim'
,
p
.
lim
,
'
style'
,
style
);
end
...
...
subtools/draft/@pb_draft/plot_rawdata.m
View file @
f5911223
...
...
@@ -29,9 +29,9 @@ function h = rawdata(~,data,p,colorindex)
%% MAKE SELECTION FOR COLOR!
sel
=
data
.
color
==
colorindex
;
x
=
data
.
x
(
sel
);
y
=
data
.
y
(
sel
);
sel
=
data
.
color
==
colorindex
;
x
=
data
.
x
(
sel
);
y
=
data
.
y
(
sel
);
color
=
pb_selectcolor
(
length
(
p
.
ncol
),
data
.
def
);
...
...
subtools/draft/@pb_draft/plot_vline.m
View file @
f5911223
...
...
@@ -5,9 +5,10 @@ function plot_vline(obj,varargin)
%
% See also PB_DRAFT
% PBToolbox (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
p
.
v
=
varargin
;
p
.
lim
=
obj
(
1
)
.
pva
.
limits
.
y
;
obj
.
dplot
=
vertcat
(
obj
.
dplot
,{
@
(
dobj
,
data
)
vline
(
dobj
,
data
,
p
)});
end
...
...
@@ -28,7 +29,7 @@ function h = vline(~,data,p)
point
=
mode
(
data
.
x
);
end
end
h
=
pb_vline
(
point
,
'style'
,
style
);
h
=
pb_vline
(
point
,
'
lim'
,
p
.
lim
,
'
style'
,
style
);
end
...
...
subtools/draft/@pb_draft/print.m
View file @
f5911223
...
...
@@ -14,11 +14,12 @@ function print(obj,varargin)
fn
=
pb_keyval
(
'fn'
,
v
,
defaultname
(
cdir
));
fit
=
pb_keyval
(
'fit'
,
v
,
'-bestfit'
);
format
=
pb_keyval
(
'format'
,
v
,
'-dpdf'
);
render
=
pb_keyval
(
'render'
,
v
,
'-painters'
);
disp
=
pb_keyval
(
'disp'
,
v
,
false
);
figure
(
h
);
loc
=
[
cdir
fn
];
print
(
fit
,
loc
,
format
);
print
(
fit
,
loc
,
format
,
render
);
if
disp
open
([
loc
'.'
format
(
3
:
end
)]);
...
...
subtools/draft/@pb_draft/private/make_axes.m
View file @
f5911223
function
make_axes
(
obj
,
ax
,
varargin
)
% PB_DRAFT>
SET_LEGEND
% PB_DRAFT>
MAKE_AXES
%
% OBJ.SET_LEGEND(varargin) rescale, size and store axes handles..
%
% See also PB_DRAFT
% PBToolbox (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
obj
(
1
)
.
h_ax_plot
=
ax
;
% TODO: LINK AXES AND FIND OPTIMAL AXE TICKS
linkaxes
(
ax
,
'xy'
);
positions
=
zeros
(
length
(
ax
),
4
);
for
iAx
=
1
:
length
(
ax
)
axis
(
ax
(
iAx
));
xt
=
xticks
;
yt
=
yticks
;
setAx
=
ax
(
iAx
);
xlim
(
ax
(
iAx
),[
xt
(
1
)
xt
(
end
)]);
ylim
(
ax
(
iAx
),[
yt
(
1
)
yt
(
end
)]);
positions
(
iAx
,:)
=
ax
(
iAx
)
.
Position
(:);
if
obj
(
1
)
.
grid
.
bool
f
=
obj
(
1
)
.
grid
.
features
;
setAx
.
Box
=
f
.
Box
;
setAx
.
TickDir
=
f
.
TickDir
;
setAx
.
TickLength
=
f
.
TickLength
;
setAx
.
XMinorTick
=
f
.
XMinorTick
;
setAx
.
YMinorTick
=
f
.
YMinorTick
;
setAx
.
YGrid
=
f
.
YGrid
;
setAx
.
XGrid
=
f
.
XGrid
;
setAx
.
YColor
=
f
.
YColor
;
setAx
.
XColor
=
f
.
XColor
;
setAx
.
FontSize
=
f
.
FontSize
;
setAx
.
YDir
=
f
.
YDir
;
setAx
.
LineWidth
=
f
.
LineWidth
;
end
end
obj
(
1
)
.
labels
.
ypos
=
min
(
positions
(:,
2
));
obj
(
1
)
.
labels
.
xpos
=
min
(
positions
(:,
1
));
obj
(
1
)
.
labels
.
pos
=
[
min
(
positions
(:,
1
))/
1.33
min
(
positions
(:,
2
))/
1.33
max
(
positions
(:,
1
)
+
positions
(:,
3
))
max
(
positions
(:,
2
)
+
positions
(:,
4
))];
obj
(
1
)
.
h_ax_plot
=
ax
;
end
...
...
subtools/draft/@pb_draft/private/make_suplabel.m
View file @
f5911223
function
make_suplabel
(
obj
,
varargin
)
% PB_DRAFT>MAKE_SUPLABEL
%
% OBJ.
SET_LEGEND
(varargin)
M
ake superlabels handle.
% OBJ.
MAKE_SUPLABEL
(varargin)
m
ake superlabels handle.
%
% See also PB_DRAFT
...
...
subtools/draft/@pb_draft/private/parse_va.m
View file @
f5911223
...
...
@@ -11,20 +11,36 @@ function parse_va(obj,varargin)
%% READ DATA
% Read Data, and set keyvals
% Read keyvals
v
=
varargin
;
pva
.
x
=
pb_keyval
(
'x'
,
v
,[]);
pva
.
y
=
pb_keyval
(
'y'
,
v
,[]);
pva
.
z
=
pb_keyval
(
'z'
,
v
,[]);
pva
.
def
=
pb_keyval
(
'def'
,
v
,
1
);
pva
.
color
=
pb_keyval
(
'color'
,
v
,
ones
(
length
(
pva
.
x
),
1
));
pva
.
axis
=
pb_keyval
(
'axis'
,
v
,
'square'
);
pva
.
axis
=
pb_keyval
(
'axis'
,
v
);
pva
.
subtitle
=
pb_keyval
(
'subtitle'
,
v
);
pva
.
linkax
=
pb_keyval
(
'link'
,
v
,
true
);
% Check data limits
[
x
,
y
]
=
setlim
(
pva
);
pva
.
limits
.
x
=
x
;
pva
.
limits
.
y
=
y
;
% Check square axis
if
isempty
(
pva
.
axis
)
if
abs
(
max
(
x
)
-
max
(
y
))
/
max
([
x
,
y
])
<.
5
pva
.
axis
=
'square'
;
end
end
% Set layout
pva
.
colscheme
=
pb_selectcolor
(
length
(
unique
(
pva
.
color
)),
pva
.
def
);
pva
.
axcomp
=
axcmp
(
pva
.
x
);
obj
.
labels
.
xlab
=
pb_keyval
(
'xlab'
,
v
,
''
);
obj
.
labels
.
ylab
=
pb_keyval
(
'ylab'
,
v
,
''
);
obj
.
grid
.
bool
=
false
;
% Check data continuity for colouring
pva
.
continious
=
false
;
...
...
@@ -35,6 +51,41 @@ function parse_va(obj,varargin)
obj
.
pva
=
pva
;
end
function
ac
=
axcmp
(
data
)
% Writes empty axcomp data struct
ac
.
prefix
=
''
;
ac
.
feature
=
ones
(
1
,
length
(
data
));
ac
.
n
=
length
(
unique
(
ac
.
feature
));
end
function
[
x
,
y
]
=
setlim
(
data
)
% Sets the limits for axes
x
=
[
min
(
data
.
x
)
max
(
data
.
x
)];
y
=
[
min
(
data
.
y
)
max
(
data
.
y
)];
xr
=
x
(
2
)
-
x
(
1
);
yr
=
y
(
2
)
-
y
(
1
);
% minimum
if
abs
(
min
(
x
))/
xr
<
.
1
;
x
(
1
)
=
0
;
end
if
abs
(
min
(
y
))/
yr
<
.
1
;
y
(
1
)
=
0
;
end
% maximum
tmp
=
max
([
x
,
y
]);
order
=
0
;
scale
=
.
1
;
if
tmp
<
1
;
scale
=
10
;
end
while
tmp
<
.
1
||
tmp
>
1
tmp
=
tmp
*
scale
;
order
=
order
+
1
;
end
tmp
=
round
(
tmp
*
100
)/
100
;
x
(
2
)
=
tmp
*
inv
(
scale
)
^
order
;
y
(
2
)
=
tmp
*
inv
(
scale
)
^
order
;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
...
...
subtools/draft/@pb_draft/set_axcomp.m
View file @
f5911223
...
...
@@ -6,7 +6,7 @@ function set_axcomp(obj,parameter,varargin)
%
% See also PB_DRAFT
% PBToolbox (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
if
nargin
<
2
||
isempty
(
parameter
);
return
;
end
...
...
@@ -30,47 +30,3 @@ end
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% 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
subtools/draft/@pb_draft/set_grid.m
View file @
f5911223
function
set_grid
(
obj
,
varargin
)
% PB_DRAFT>SET_GRID
%
% SET_
TITLE
(obj,title,varargin)
..
.
% SET_
GRID
(obj,title,varargin)
will set grid parameters
.
%
% See also
...
% See also
PB_DRAFT
% PBToolbox (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
v
=
varargin
;
f
.
Box
=
pb_keyval
(
'box'
,
v
,
'off'
);
f
.
TickDir
=
pb_keyval
(
'tickdir'
,
v
,
'in'
);
f
.
TickLength
=
pb_keyval
(
'ticklength'
,
v
,[
.
02
.
02
]);
f
.
XMinorTick
=
pb_keyval
(
'XMinorTick'
,
v
,
'on'
);
f
.
YMinorTick
=
pb_keyval
(
'YMinorTick'
,
v
,
'on'
);
f
.
YGrid
=
pb_keyval
(
'YGrid'
,
v
,
'on'
);
f
.
XGrid
=
pb_keyval
(
'XGrid'
,
v
,
'on'
);
f
.
YColor
=
pb_keyval
(
'YColor'
,
v
,[
.
3
.
3
.
3
]);
f
.
XColor
=
pb_keyval
(
'XColor'
,
v
,[
.
3
.
3
.
3
]);
f
.
FontSize
=
10
;
f
.
YDir
=
'normal'
;
f
.
LineWidth
=
.
1
;
obj
(
1
)
.
grid
.
bool
=
true
;
obj
(
1
)
.
grid
.
features
=
f
;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (201
8
) %
% Written by: Jesse J. Heckman (201
9
) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
subtools/draft/example_draft.m
View file @
f5911223
%% Example code 'draft'
pb_clean
;
load
(
'exD_saccade'
);
%% first figure draft