Skip to content
Snippets Groups Projects
Commit 86fda587 authored by fritsch's avatar fritsch
Browse files

Upload New File

parent 0d0f9912
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment