4 min read

Crocheting & plotting: circles vs. spirals

If there’s one thing I’m passionate about, it’s combining my passions. So right now I’m going to visualize crochet circles using R’s ggplot2 package.

Rest assured I’m going to keep the crochet jargon to a minimum. First things first, I need to load the ggplot2 package.

library(ggplot2)

Crochet patterns

Years ago, before I discovered pinterest and ravelry, I used to design a lot of my own crochet patterns. It took a lot of trial and error, and to be honest, they didn’t always come out very good. I made a yoga mat bag and it was fine, but I always felt I could do better.

These last few years I’ve mostly used patterns that other people have written. But I wanted to take another shot at designing and making a yoga mat bag. I also thought it would be a good starting point for something else I’ve been wanting to do: program and visualize crochet patterns using R.

Start with a circular base

As everyone likely knows, yoga mats can be rolled up into a cylinder when they’re not being used. So that’s the shape of just about every yoga mat bag: a cylinder. And to crochet a cylinder, you would start with a circle for the base.

I’ll start with a magic ring and make six single crochet stitches in it for the inner most part of the circle. Then I’ll immediately start on round 2, working two single crochet stitches into each of the 6 stitches from round one. So round 2 ends up with 12 stitches. I keep going, adding 6 stitches to each round, until we get 72 stitches at the end of round 12. This method is worked continuously so you don’t really stop at the end of a round, and is referred to as crocheting in the round.

In theory, I expect that base circle will look like this scatterplot made using ggplot2:

Note that while I said I was making a circle, I technically made a spiral that approximates a circle. I kind of look at it like how old vinyl records have just one continuous groove. You can trace the path from the center all the way out to the farthest point.

I could have made a pure circle if I wanted to. If I did, I would end each round of the circle by joining the yarn to the first stitch of the round with a slip stitch, then chaining one stitch and crocheting the next round. This is called joining rounds A scatterplot of this method looks like this:

If you look closely you can see that this is 12 nested circles. I added a few extra points to show one of the drawbacks of joining rounds: you get a visible seam where the joins are, from the one chain stitch. (The seam usally is not noticeable enough in crocheted items to be an issue.)

Crocheting in the round is not without its own drawbacks. It’s hard to keep track of where rounds begin and end. It’s a good idea to use a stitch marker to mark the beginning of a new round when you crochet in the round.

Spiral function

Btw, it took me a while to write a spiral function to plot points that are evenly spaced from each other. Every algorithm I tried would cluster the points more toward the center, with points farther from the center more spaced out.

Here is the final working version. It recalcuates phi and the radius for each point:

## evenly spaced points on a spiral
spiral_points <- function(arc = 1, separation = 1, n) {
  r <- arc
  b <- separation / (2*pi)
  phi <- r / b
  xs <- c()
  ys <- c()
  while(n > 0) {
    xs <- c(xs, r * cos(phi))
    ys <- c(ys, r * sin(phi))
    phi <- phi + (arc / r)
    r <- b * phi
    n <- n - 1
  }
  df <- data.frame(x = xs, y = ys)
}

Crochet versions (circle and spiral)

Now that I’ve plotted the two versions of a crochet circle, it’s time to look at actual crochet circles:

The joined rounds (nested “circles”) one is on the left. As you can see, the seam is not very noticeable. The crocheted in the round (spiral) one is on the right. (You can see my stitch marker is still there.) Unlike the one on the left, the final stitch of the last round does not neatly line up with the beginning stitch of that round. But they look very much the same.

But wait! Now that I look at these crocheted circles, I see…

THEY LOOK MORE LIKE HEXAGONS!!!!! I suppose I need to start over? Do I change the crochet pattern, or the plots??