T
Trick Nick
I have everything done my output goes to a graph everything is fine
except now i need to put labels on the x axis for each decade. So
currently Y-axis Says: population X-axis says: years and they Y-Axis has
the years posted on the side for each row. BUT how do i get 1951 - 2004
to post on the bottom the graph (every decade not ever year)
Heres wat i got so far plz any help appreciated?
ARGV.each do |arg|
countriesString << ",\"#{arg.to_s}\""
form_params['my_countries'] = "#{countriesString}"
#FORM PARAMS COMPLETED
#COLLECT DATA
results =
Net::HTTP.post_form(URI.parse('http://pwt.econ.upenn.edu/php_site/...pwt62/pwt62_retrieve.php'),
form_params)
parse_page = Hpricot(results.body)
popData_H = (parse_page/"pre").inner_html
popCSV = CSV.parse(popData_H.to_s {|f| f.read})
#END COLLECT DATA
#PREPARE TO GRAPH
label = arg
popdata = popCSV.map { |x| x[3].to_i }
if popdata[2]% 10 == 0 || popdata[2] == 1951 || popdata[2] == 2004
labels = popdata
end
popdata.delete(0)
pg.data(label, popdata)
pg.x_axis_label = "Years"
pg.y_axis_label = "Population"
countriesString = ''
end
pg.write('population_graph.png')
except now i need to put labels on the x axis for each decade. So
currently Y-axis Says: population X-axis says: years and they Y-Axis has
the years posted on the side for each row. BUT how do i get 1951 - 2004
to post on the bottom the graph (every decade not ever year)
Heres wat i got so far plz any help appreciated?
ARGV.each do |arg|
countriesString << ",\"#{arg.to_s}\""
form_params['my_countries'] = "#{countriesString}"
#FORM PARAMS COMPLETED
#COLLECT DATA
results =
Net::HTTP.post_form(URI.parse('http://pwt.econ.upenn.edu/php_site/...pwt62/pwt62_retrieve.php'),
form_params)
parse_page = Hpricot(results.body)
popData_H = (parse_page/"pre").inner_html
popCSV = CSV.parse(popData_H.to_s {|f| f.read})
#END COLLECT DATA
#PREPARE TO GRAPH
label = arg
popdata = popCSV.map { |x| x[3].to_i }
if popdata[2]% 10 == 0 || popdata[2] == 1951 || popdata[2] == 2004
labels = popdata
end
popdata.delete(0)
pg.data(label, popdata)
pg.x_axis_label = "Years"
pg.y_axis_label = "Population"
countriesString = ''
end
pg.write('population_graph.png')