pylab
Yes, I love python. However, I am no expert. Most of the stuff I write in python is dirty and ugly code. Sometimes I figure out new things (things that programmers already know) and sometimes I forget these things. So, here are a few tips and tricks that I use from time to time. Really, I am writing this for future Rhett when he does a google search for "how do you save data to a file in python".
Saving data to a file
Suppose I am modeling a basketball falling through the air. I want to plot this data, so I save position and time data in lists. For example: Here is the info from scipy…
(alternate title: how to make pretty graphs in vpython)
I am happy. Finally, I can use the visual module in python (vPython.org) and plotting with Matplotlib. Maybe this isn't such a big deal for many of you, but for me, it never worked until now.
In the past, I blogged about plotting in vpython vs. matplotlib. My conclusion was that it was easier in vpython, but prettier in matplotlib. So, why not just use matplotlib? There are a couple of things that make vypthon very attractive.
Vectors. Vpython has a built in vector class (or function - I don't know what I am talking about). There…
I am not a programmer. Just to be clear. I use python to get things done, but I am sure it could be done in more efficient ways. Anyway, I sure you know how much I like vpython - especially for teaching physics. However, sometimes I use it for blogging stuff also. The problem is that vpython doesn't make pretty graphs. Oh, they are quick and simple - but sometimes you want pretty also. Well, what if you just don't use vpython? Of course then I could use some other plotting package like pylab (which actually uses something else like matplotlib or something - I get confused). Or, I…