# Thread: convert data points to graph coordinates

1. ## convert data points to graph coordinates

This should be simple... but I'm having a hard time coming up with an equation that works every time.

Let's say I have a point, p=(91,1), and I need to plot it on my 2d graph, which, in OpenGL has the x-axis: (1, -> (9,, and the y-axis: (1, -> (1,1), because y increases in the downward direction.

So, how do I convert the point 'p' so that is shows at the right place on the graph?

Cheers.

2. ## Re: convert data points to graph coordinates

I should add that the point p=(91,1) is actual data. So, I do know the max x and max y values as well.

3. ## Re: convert data points to graph coordinates

1:1 scale
---------
graph_x = 1+x
graph_y = 8-y

scaled
------
graph_x = 1+(x/max_x*
graph_y = 8-(y/max_y*7)

But that is surely not what you are looking for? You need to be more elaborate.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•