import graph;
import palette;
+import stats;
real fsize=10;
}
}
+void histFile(picture pic=currentpicture, string file="datafile",
+ int bin_col=0, int count_col=1,
+ real bin_scale=1, real count_scale=1, real low=-infinity,
+ pen fillpen=red, pen drawpen=nullpen, bool bars=false,
+ string t="Title") {
+ file fin = input(file).line();
+ real[][] a = fin.dimension(0,0);
+ a = transpose(a);
+ real[] bins = a[bin_col] * bin_scale;
+ real[] count = a[count_col] * count_scale;
+ /* Convert bin-center marks to bin-edge marks */
+ real bin_width = bins[1]-bins[0];
+ bins = bins - bin_width / 2; /* shift centers to the left */
+ bins.push(bins[bins.length-1]+bin_width); /* add terminal edge on right */
+ /* Normalize counts -> frequency */
+ real total = sum(count);
+ count = count / total;
+ if (t != "Title") {
+ histogram(pic=pic, bins=bins, count=count, low=low,
+ fillpen=fillpen, drawpen=drawpen, bars=bars,
+ legend=sLabel(t,extra_spaces=1));
+ } else {
+ histogram(pic=pic, bins=bins, count=count, low=low,
+ fillpen=fillpen, drawpen=drawpen, bars=bars);
+ }
+}
+
real[] identity_zfn(real[] z) {
return z;
}
import wtk_graph;
-size(15cm,10cm,IgnoreAspect);
-scale(Log, Linear);
+//size(15cm, 10cm, IgnoreAspect);
+
+picture sd;
+size(sd, 13cm, 5cm, IgnoreAspect);
+
+scale(sd, Log, Linear);
real xscale=1e9;
real yscale=1e12;
return params[0] * log10(x) + params[1];
}
-graphFile("v_dep-5e-5_0.1e-9/v_dep", ycol=2, xscale=xscale, yscale=yscale,
- p=psoft,
- t="$k_{u0}=5\E{-5}\U{s$^-1$}, \Delta x_u=0.100\U{nm}", dots=true);
-graphFile("v_dep-1e-5_0.225e-9/v_dep", ycol=2, xscale=xscale, yscale=yscale,
- p=pmed,
- t="$k_{u0}=1\E{-5}\U{s$^-1$}, \Delta x_u=0.225\U{nm}", dots=true);
-graphFile("v_dep-5e-5_0.225e-9/v_dep", ycol=2, xscale=xscale, yscale=yscale,
- p=phard,
- t="$k_{u0}=5\E{-5}\U{s$^-1$}, \Delta x_u=0.225\U{nm}", dots=true);
-fitFile("v_dep-5e-5_0.1e-9/v_dep-sd.fit.dat", f=fn_logxliny,
+graphFile(sd, "v_dep-5e-5_0.1e-9/v_dep", ycol=2,
+ xscale=xscale, yscale=yscale, p=psoft,
+ t="$k_{u0}=5\E{-5}\U{s$^{-1}$}$, $\Delta x_u=0.100\U{nm}$",
+ dots=true);
+graphFile(sd, "v_dep-1e-5_0.225e-9/v_dep", ycol=2,
+ xscale=xscale, yscale=yscale, p=pmed,
+ t="$k_{u0}=1\E{-5}\U{s$^{-1}$}$, $\Delta x_u=0.225\U{nm}$",
+ dots=true);
+graphFile(sd, "v_dep-5e-5_0.225e-9/v_dep", ycol=2,
+ xscale=xscale, yscale=yscale, p=phard,
+ t="$k_{u0}=5\E{-5}\U{s$^{-1}$}$, $\Delta x_u=0.225\U{nm}$",
+ dots=true);
+fitFile(sd, "v_dep-5e-5_0.1e-9/v_dep-sd.fit.dat", f=fn_logxliny,
xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=psoft);
-fitFile("v_dep-1e-5_0.225e-9/v_dep-sd.fit.dat", f=fn_logxliny,
+fitFile(sd, "v_dep-1e-5_0.225e-9/v_dep-sd.fit.dat", f=fn_logxliny,
xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=pmed);
-fitFile("v_dep-5e-5_0.225e-9/v_dep-sd.fit.dat", f=fn_logxliny,
+fitFile(sd, "v_dep-5e-5_0.225e-9/v_dep-sd.fit.dat", f=fn_logxliny,
xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=phard);
+xequals(sd, x=1e-6*xscale, p=dashed);
-label(sLabel("Pulling speed dependence"), point(N),N);
-xaxis(sLabel("Pulling speed (nm/s)"),BottomTop,LeftTicks);
-yaxis(sLabel("Unfolding force (pN)"),LeftRight,RightTicks);
-/*
-set size 0.33,0.4
-unset key
-set tmargin -1
-set xrange [100:900]
-#set yrange [1e-4:1e-1]
-unset logscale x
-set logscale y
-set xtics 100,200
-set ytics format "10^{%L}"
-set xtics format "%g"
-set xlabel 'Force (pN)'
-set ylabel 'Frequency'
-set boxwidth 20
-set style data boxes
-set style fill solid 0.3
-#set style fill pattern 4
-
-# dummy plot to fix some sizing issue...
-set origin 1,1
-plot x
+xaxis(sd, sLabel("Pulling speed (nm/s)"), BottomTop, LeftTicks);
+yaxis(sd, sLabel("Unfolding force (pN)"), LeftRight, RightTicks);
+add(sd, legend(sd), point(sd, E), 20E, UnFill);
-set origin 0.0,0.6
-plot 'fig4i-5e-5_0.1e-9.hist' using ($1*1e12+10):($2/3200)
-
-set origin 0.33,0.6
-plot 'fig4i-1e-5_0.225e-9.hist' using ($1*1e12+10):($2/3200)
+picture hist_picture(string datafile,
+ real xmin=-infinity, real xmax=infinity,
+ real ymin=-infinity, real ymax=infinity) {
+ picture pic;
+ size(pic, 4cm, 3cm, IgnoreAspect);
+ scale(pic, Linear, Log);
+ histFile(pic, datafile, bin_scale=yscale, low=ymin);
+ /* ^-- yscale b/c bins are in Force */
+ xlimits(pic, xmin, xmax);
+ ylimits(pic, ymin, ymax);
+ xaxis(pic, sLabel("Force (pN)"), BottomTop, LeftTicks);
+ yaxis(pic, sLabel("Frequency"), LeftRight, RightTicks);
+ return pic;
+}
-set origin 0.67,0.6
-plot 'fig4i-5e-5_0.225e-9.hist' using ($1*1e12+10):($2/3200)
+/* ensure consistent ranges across all histograms */
+real xmin = 100;
+real xmax = 900;
+real ymin = 1e-4;
+real ymax = 1;
-unset multiplot
-*/
+add(sd.fit(), (0,0), S);
+add(hist_picture("fig4i-5e-5_0.1e-9.hist", xmin, xmax, ymin, ymax).fit(),
+ 4cm*W, N);
+add(hist_picture("fig4i-1e-5_0.225e-9.hist", xmin, xmax, ymin, ymax).fit(),
+ (0,0), N);
+add(hist_picture("fig4i-5e-5_0.225e-9.hist", xmin, xmax, ymin, ymax).fit(),
+ 4cm*E, N);
+label(sLabel("Pulling speed width dependence"), point(N)+(0,3cm), N);
}
graphFile("v_dep-5e-5_0.1e-9/v_dep", xscale=xscale, yscale=yscale, p=psoft,
- t="$k_{u0}=5\E{-5}\U{s$^-1$}, \Delta x_u=0.100\U{nm}", dots=true);
+ t="$k_{u0}=5\E{-5}\U{s$^{-1}$}$, $\Delta x_u=0.100\U{nm}$",
+ dots=true);
graphFile("v_dep-1e-5_0.225e-9/v_dep", xscale=xscale, yscale=yscale, p=pmed,
- t="$k_{u0}=1\E{-5}\U{s$^-1$}, \Delta x_u=0.225\U{nm}", dots=true);
+ t="$k_{u0}=1\E{-5}\U{s$^{-1}$}$, $\Delta x_u=0.225\U{nm}$",
+ dots=true);
graphFile("v_dep-5e-5_0.225e-9/v_dep", xscale=xscale, yscale=yscale, p=phard,
- t="$k_{u0}=5\E{-5}\U{s$^-1$}, \Delta x_u=0.225\U{nm}", dots=true);
+ t="$k_{u0}=5\E{-5}\U{s$^{-1}$}$, $\Delta x_u=0.225\U{nm}$",
+ dots=true);
fitFile("v_dep-5e-5_0.1e-9/v_dep.fit.dat", f=fn_logxliny,
xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=psoft);
fitFile("v_dep-1e-5_0.225e-9/v_dep.fit.dat", f=fn_logxliny,
xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=pmed);
fitFile("v_dep-5e-5_0.225e-9/v_dep.fit.dat", f=fn_logxliny,
xmin=1e-9, xmax=1e-5, xscale=xscale, yscale=yscale, p=phard);
+xequals(x=1e-6*xscale, p=dashed);
label(sLabel("Pulling speed dependence"), point(N), N);
xaxis(sLabel("Pulling speed (nm/s)"), BottomTop, LeftTicks);
yaxis(sLabel("Unfolding force (pN)"), LeftRight, RightTicks);
+
+add(legend(), point(E), 20E, UnFill);