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,8) -> (9,8), and the y-axis: (1,8) -> (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?


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.

1:1 scale

graph_x = 1+x
graph_y = 8-y


graph_x = 1+(x/max_x8)
graph_y = 8-(y/max_y

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