Skip to content

Instantly share code, notes, and snippets.

@ohmygodwin
Created January 28, 2016 18:13
Show Gist options
  • Save ohmygodwin/7e2ec43b435ffef2091e to your computer and use it in GitHub Desktop.
Save ohmygodwin/7e2ec43b435ffef2091e to your computer and use it in GitHub Desktop.
//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