how to fit graph to window?

Started by
0 comments, last by yckx 16 years, 9 months ago
I'm trying to plot many points on my graph, and it's work, sort of. My screen size is 400x400. And the points that I have, do draw on the graph, but the size is out of proportion to the size of the graph. My max x coord is 100 and my max y is 80, so the graph is drawn really small in the lower left of the screen. How do I scale it to the proper size so that it fills up whatever size the window is?
Advertisement
You can scale the graph to the window by dividing the resolution by the max value on each axis. So, you'd have 400/100 = 4 pixels per unit on the X-axis and 400/80 = 5 pixels per unit on the Y-axis. Or, if you don't want to skew the graph, use the smaller ratio for both axes, in this case, 4 pixels per unit on both axes.

This topic is closed to new replies.

Advertisement