set increments in data plot
I am working on a project for school and I have all the important parts done, however I am having trouble writing an algorithm for setting the grid increments for a graph.
The increments must be a power of 10 multiplied by 1, 2 or 5 (1, 2, 6, 10, 20, 50, 100, 200, 500 etc.
I cant just set it to be huge because the points that will be graphed must be stretched across a large part of the graph.
So i need to write an algorithm that will know the max value for X and Y to be entered and then come up with the increments.
Re: set increments in data plot
What have you come up with so far?
If you're stuck for ideas try taking a piece of paper, picking a number at random and deciding what increments you would use so that the number appeared close to the edge of the paper. Pay attention to your thought processes and ask yourself why you choose that increment and not a larger or smaller one. This may form the basis of an algorithm that you can make precise and use to write your code.
Apart from anything else such an exercise may help you get a sharper idea of what is actually needed. It seems to me that merely knowing the maximum value is not enough to decide the increment.