svg multiple color on circle stroke

This approach won’t work. SVG doesn’t have conical gradients. To simulate the effect, you would have to fake it with a large number of small line segments. Or some similar technique. Update: Here is an example. I approximate the 360deg of hue with six paths. Each path contains an arc which covers 60deg of the … Read more

Closest point on a cubic Bezier curve?

I’ve written some quick-and-dirty code that estimates this for Bézier curves of any degree. (Note: this is pseudo-brute force, not a closed-form solution.) Demo: http://phrogz.net/svg/closest-point-on-bezier.html /** Find the ~closest point on a Bézier curve to a point you supply. * out : A vector to modify to be the point on the curve * curve … Read more

In Scipy how and why does curve_fit calculate the covariance of the parameter estimates

OK, I think I found the answer. First the solution: cov_x*s_sq is simply the covariance of the parameters which is what you want. Taking sqrt of the diagonal elements will give you standard deviation (but be careful about covariances!). Residual variance = reduced chi square = s_sq = sum[(f(x)-y)^2]/(N-n), where N is number of data … Read more

ggplot2: histogram with normal curve

Think I got it: set.seed(1) df <- data.frame(PF = 10*rnorm(1000)) ggplot(df, aes(x = PF)) + geom_histogram(aes(y =..density..), breaks = seq(-50, 50, by = 10), colour = “black”, fill = “white”) + stat_function(fun = dnorm, args = list(mean = mean(df$PF), sd = sd(df$PF)))