In programming in Java I've frequently wanted to plot functions, meaning I've had to convert a double array of function values (and a corresponding array of their domain values) to integer arrays of coordinates to plot. I've always found this to be a pain in the neck, especially if you're trying to have the number of points plotted depend on how much space you have available in the x direction. (I suppose if I were a more organized person, I would've just solved this problem once and completely generally and then just copy-and-pasted it into new programs.) Even when I finally get it right, the code it takes to do this ends up being confusing and somewhat unreadable. How do you guys deal with this kind of problem?