Look at Ruby-GD2 or an ImageMagick or GraphicsMagick binding.
In Python, you'd typically use PIL, the Python Image Library. I've never used PIL for anything beyond the simplest tasks, so I can't say how well it performs in practice.
I'd start digging into PIL with a look at its documentation, particularly the documentation for the draw module.
Maybe a vectorial format is better suited for your needs, but is hard to tell without having a concrete example of what you'd like to get.
For example, if the images are all alike, you could create a SVG base image with Inkscape, then edit it programmaticaly from Python or Ruby (either by editing the text or using a XML library) and finally export it to PNG.
Update: After seeing the example image, I think SVG would be the most convenient choice. A SVG image is an XML file that basically says "draw a circle from here to here, write the string '13º52' there", etc. You could draw a unique base chart in Inkscape and have your program just adding the lines and symbols for each case. Finally you export to PNG.
The advantages are: easier for you to draw, the image is fully scalable, you can change the styling just by editing a property ("make all lines wider", "change all text to Arial", "paint the background blue"), you can export to any format without losing quality, and I think it's more mantainable.
I found Gruff easy to use when I was in your shoes. Shameless blog plug.
when I was doing python chalange (http://www.pythonchallenge.com/) I've used Python Image Library (http://www.pythonware.com/library/pil/)
For Python I the most common choice for image formats is PIL and then Pycairo for vector formats. The two can work together, for exadmple in this cookbook entry to use PIL images for Pycairo surfaces.