We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Scaling a graph
Page Index Toggle Pages: 1
Scaling a graph (Read 803 times)
Scaling a graph
Apr 17th, 2009, 7:53am
 
If I have a fixed axis  displayed on the screen on which to plot a graph
How do I scale the graph so that it always fit the axis?

I have two arrays: x[i] and y[i] and I want them to be scaled in a graph which is 500px wide and 300px wide.
Re: Scaling a graph
Reply #1 - Apr 17th, 2009, 8:09am
 
i guess thats not the whole code
Re: Scaling a graph
Reply #2 - Apr 17th, 2009, 12:24pm
 
Take max() and min() of both arrays, and use map() to... map your coordinates to the needed sketch coordinates.
Re: Scaling a graph
Reply #3 - Apr 18th, 2009, 6:09am
 
got it thanks!
Page Index Toggle Pages: 1