Hi,
I am trying to plot population data (from three years) from a CSV file onto a map of the UK but am not sure how to do this. I have gathered the X and Y coordinates (and they correspond correctly to the map) of each city in the CSV files, but I am not sure how to plot this onto the map in processing (I would like to do something like a 3D bar chart). I would also like to switch between the years.
Here is the csv:
Here is the code:
import peasy.*;
PImage map;
Table data;
PeasyCam camera;
PVector position;
void setup() {
size(800, 800, P3D);
map = loadImage("map.jpg");
camera = new PeasyCam(this, 3000);
camera.setMinimumDistance(100);
camera.setMaximumDistance(3500);
position = new PVector(-map.width/2, 200, -map.height/2);
data = loadTable("Data.csv", "header");
}
void draw() {
background (#000000);
mapSetup();
adjustCamera();
plot();
}
void mapSetup() {
pushMatrix();
translate(position.x, position.y, position.z);
rotateX(radians(90));
image (map, 0, 0);
popMatrix();
}
void adjustCamera() {
camera.setRotations(radians(25), radians((((float)mouseX/width) * 90) - 45), 0);
}
**void plot() {**
**}**
void keyPressed() {
if (key == CODED) {
if (keyCode == UP) {
position.z += 50;
}
if (keyCode == DOWN) {
position.z -= 50;
}
if (keyCode == LEFT) {
position.x += 50;
}
if (keyCode == RIGHT) {
position.x -= 50;
}
}
}
Any help with this would be greatly appreciated.
Y