osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggestions for plotting slide rule & sector scales?


I like old scientific instruments & that sort of thing, & am wondering
what libraries I could use for programmatically generating
mathematical scales, ideally able to display the result in the GUI &
save it as a png (or other standard graphics format).  Ideally, I'd
like to be able to write code like this:

line = foo_library.draw_line(0, 0, 100, 0)

for x in range(1,101):
    line.add_minor_tick(math.log10(x) * 100/2, side=top)

for x in range(1,11):
    line.add_major_tick(math.log10(x*10) * 100/2, label=str(x), side=top)

for x in range(0,100):
    line.add_minor_tick(x, side=bottom)

for x in range(0,10):
    line.add_major_tick(x*10, label=str(x), side=bottom)

and get a line 100 mm long with a log scale on the top and a linear
scale on the bottom.

Thanks,
Adam


-- 
It takes a thousand men to invent a telegraph, or a steam engine, or a
phonograph, or a telephone or any other important thing --- and the
last man gets the credit and we forget the others.       ---Mark Twain