Generating plots with pgfplots

Plotting results is often needed in Computer Science.
Say, you have a program that generates data which you want to plot.

A normal approach to this would be:

  1. Write your results to a csv-file
  2. Importing that file into a spreadsheet application like Excel
  3. Clicking around to generate a plot
  4. Saving the plot as an image
  5. Putting the image into a LaTeX report

In case you change something in your program, this entire process would have to be repeated in order to get your fresh results plotted and into your report.

How cumbersome. This is a stupid problem we can solve with programming.
If our program already generates data and writes it to disk in text format, we can just add functions that write that data as LaTeX!
Continue reading “Generating plots with pgfplots”

Why do your assignments when you can make python do them for you?

I have gotten into writing my own tools, whenever I realize it’s an option.

I will try to document my process of doing this, starting with one of my favourite projects. It’s not pretty, but it did the job for me.

Anyone who has taken a good course on linear algebra knows row operations. They’re fun, they’re easy to program and you can solve systems of equations with them. It’s all great, up until the point where you have to write them.

If you’re an unlucky fellow, you will do this by hand, and no amount of petting the wildebeest will help you. If you’re a, until now, little less unlucky fellow, you will do this with \LaTeX. It’s cumbersome and boring and I grew tired of it within 10 minutes. I guess it’s time for a tool, huh?
Continue reading “Why do your assignments when you can make python do them for you?”