Public Group

# how to fit graph to window?

This topic is 4212 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 15
• 11
• 11
• ### Forum Statistics

• Total Topics
634149
• Total Posts
3015832
×