hi im trying to make graph using processing
in
Programming Questions
•
2 months ago
ive tried to graph an x and y vector but all i get is something wrong i know computers dont use Cartesian graph instead an x and y way of putting things on the screen. what i like to know is how do i make so my program plugs in the right
x and y to form a graph graphing them correctly on the screen here is the code i have so far. also im new to computer programming and dont know how to give my program correct variables names so if you see a few naming mistakes dont worry i kno i cant name things properly so bear with thanks. heres the code
- size(200,200);
for(int x = 20; x <= 180; x += 20)
{
line(x,20,x ,180);
}
for(int x = 20; x <= 180; x += 20)
{
line(20,x,180,x);
}
float space = 20;
float bottom = space + 80;
//middle
fill(255,0,0);
ellipse(bottom,bottom,10,10);
float incrementbyy = 20;
float incrementbyx = 4;
float frombottom = 80;
//top
fill(0,250,0);
ellipse(bottom,bottom - frombottom,10,10);
//bottom
fill(0,250,0);
ellipse(bottom,bottom + frombottom,10,10);
//left side
fill(0,250,0);
ellipse(bottom - frombottom,bottom,10,10);
//right side
fill(0,250,0);
ellipse(bottom + frombottom,bottom,10,10);
float incrementbyy1 = 20;
for(int i = 0; i <= 160; i += incrementbyy1)
{
fill(0,50,100);
ellipse(bottom,bottom - frombottom + i ,5,5);
}
for(int i = 0; i <= 160; i += incrementbyy1)
{
fill(0,50,100);
ellipse(bottom - frombottom + i,bottom ,5,5);
}
fill(0,0,255);
ellipse(20,20,2,2);
1