• Advertisement
Sign in to follow this  

how to fit graph to window?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement