Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
inPhase code repository
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fritsch
inPhase code repository
Commits
86fda587
Commit
86fda587
authored
2 years ago
by
fritsch
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
0d0f9912
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Data Analysis/plotFitInPhase.m
+102
-0
102 additions, 0 deletions
Data Analysis/plotFitInPhase.m
with
102 additions
and
0 deletions
Data Analysis/plotFitInPhase.m
0 → 100644
+
102
−
0
View file @
86fda587
function
plotFitInPhase
(
dataIn
,
isErrorbar
,
colorIn
)
if
~
exist
(
'colorIn'
,
'var'
)
colorIn
=
lines
(
1
);
figure
;
hold
on
singeData
=
true
;
else
singeData
=
false
;
end
if
~
exist
(
'isErrorbar'
,
'var'
)
isErrorbar
=
0
;
end
% plot the raw data (used in fit blue, not used red)
indx
=
dataIn
.
usedConcentrationsFitInd
;
currX
=
dataIn
.
proteinConcentrations
;
currY
=
dataIn
.
volumeFraction
;
if
~
isErrorbar
swarmchart
(
currX
(
indx
),
currY
(
indx
),
15
,
colorIn
,
'filled'
,
'MarkerFaceAlpha'
,
0.5
)
if
sum
(
~
indx
)
>
0
&&
singeData
swarmchart
(
currX
(
~
indx
),
currY
(
~
indx
),
15
,
'r'
,
'filled'
,
'MarkerFaceAlpha'
,
0.5
)
end
else
indx
=
dataIn
.
usedConcentrationsFit
;
currX
=
unique
(
dataIn
.
proteinConcentrations
);
currY
=
dataIn
.
volFracMean
;
currY_err
=
dataIn
.
volFracMean_Std
;
errorbar
(
currX
(
indx
),
currY
(
indx
),
currY_err
(
indx
),
'LineStyle'
,
'none'
,
...
'Color'
,
colorIn
,
'Linewidth'
,
2
)
plot
(
currX
(
indx
),
currY
(
indx
),
'o'
,
'MarkerSize'
,
12
,
...
'MarkerEdgeColor'
,
'none'
,
'MarkerFaceColor'
,
colorIn
)
if
sum
(
~
indx
)
>
0
&&
singeData
plot
(
currX
(
~
indx
),
currY
(
~
indx
),
'o'
,
'MarkerSize'
,
12
,
...
'Linewidth'
,
2
,
'MarkerEdgeColor'
,
'none'
,
'MarkerFaceColor'
,
'r'
)
end
end
% plot the fited curve
currX
=
0
:
0.01
:
max
(
currX
);
currY
=
dataIn
.
a_slope
.*
currX
+
dataIn
.
b_offset
;
plot
(
currX
,
currY
,
'-'
,
'Color'
,
colorIn
,
'LineWidth'
,
3
)
% label and adjust figure
xlabel
(
'Concentration (µM)'
)
ylabel
(
'Volume Fraction Vin / Vtot'
)
set
(
gca
,
'Fontsize'
,
25
,
'Tickdir'
,
'out'
,
'LineWidth'
,
3
)
set
(
gcf
,
'Position'
,
[
20
20
800
300
])
set
(
gca
,
'linewidth'
,
3
)
prevLim
=
get
(
gca
,
'Xlim'
);
xMax
=
max
([
currX
,
prevLim
]);
xlim
([
0
,
xMax
*
1.05
])
prevLim
=
get
(
gca
,
'Ylim'
);
yMax
=
max
([
currY
,
prevLim
]);
ylim
([
0
,
yMax
*
1.2
])
ax
=
gca
;
ax
.
YAxis
.
Exponent
=
-
3
;
% generate legend
currLegend
=
[
dataIn
.
proteinName
,
' ('
,
...
num2str
(
dataIn
.
saltConcentration
),
'mM KCl, '
,
...
num2str
(
dataIn
.
temperature
),
'C, '
,
...
num2str
(
dataIn
.
labelingFraction
.*
100
),
'% label, '
,
...
'ccon='
,
num2str
(
round
(
dataIn
.
Cin
)),
...
'pm'
,
num2str
(
round
(
dataIn
.
Cin_err
)),
...
', cdil='
,
num2str
(
round
(
dataIn
.
Cout
,
2
)),
...
'pm'
,
num2str
(
round
(
dataIn
.
Cout_err
,
2
)),
...
', rsq='
,
num2str
(
round
(
dataIn
.
rsquare
,
2
)),
')'
];
if
~
isempty
(
ax
.
Legend
)
if
isErrorbar
prevLegend
=
ax
.
Legend
.
String
;
indx
=
~
contains
(
prevLegend
,
'data'
);
currLegend
=
{
currLegend
,
prevLegend
{
indx
}};
h
=
get
(
gca
,
'Children'
);
h
=
h
(
2
:
3
:
end
);
legend
(
h
,
currLegend
,
'FontSize'
,
12
)
else
prevLegend
=
ax
.
Legend
.
String
;
indx
=
~
contains
(
prevLegend
,
'data'
);
currLegend
=
{
currLegend
,
prevLegend
{
indx
}};
h
=
get
(
gca
,
'Children'
);
h
=
h
(
2
:
2
:
end
);
legend
(
h
,
currLegend
,
'FontSize'
,
12
)
end
else
if
isErrorbar
h
=
get
(
gca
,
'Children'
);
h
=
h
(
2
);
legend
(
h
,
currLegend
,
'FontSize'
,
12
)
else
legend
(
currLegend
,
'FontSize'
,
12
)
end
end
if
singeData
hold
off
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment