Created
January 28, 2016 18:13
-
-
Save ohmygodwin/7e2ec43b435ffef2091e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//create an array to hold the values you want to graph | |
int[] numbers = {324,562,637,444,692,402,590}; | |
void setup() { | |
size(800,800); | |
background(255); | |
} | |
void draw() { | |
fill(0); | |
//use a for loop to iterate through each entry in the array | |
for (int i = 0; i < numbers.length; i++) { | |
//use the map function to scale the values to fit the size of the window | |
float m = map(numbers[i],300,700,5,50); | |
//draw a circle at each position scaled to the proper size | |
ellipse(i*100+100,height-numbers[i],m,m); | |
println(numbers[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment