bennacer860 / benford_s_law

9 stars 4 forks source link

Use a different graphing/charting utility #3

Closed ghost closed 11 years ago

ghost commented 11 years ago

As for the making of the chart, you might want to use something like ascii_charts to produce really nice looking graphs or charts. Here's an example. Say we use that ascii_charts gem. We take the hash that your script already gives us, and convert it into an array. Then we use the ascii_charts gem.

array = []
{"1"=>56.86, "2"=>20.68, "3"=>8.15, "4"=>5.37, "5"=>2.98, "6"=>2.19, "7"=>0.99, "8"=>1.19, "9"=>1.59}.each { |k,v| array << [k,v] }
puts AsciiCharts::Cartesian.new(array).draw

And get a really nice looking result of.

60.0|                  
55.0|*                 
50.0|                  
45.0|                  
40.0|                  
35.0|                  
30.0|                  
25.0|                  
20.0|  *               
15.0|                  
10.0|    *             
 5.0|      * *         
 0.0+----------*-*-*-*-
     1 2 3 4 5 6 7 8 9

Or maybe even experiment with Google Charts?

bennacer860 commented 11 years ago

This is an awesome idea, i will try it and see. I am sure AsciiCharts::Cartesian is better to visualize the data than the custom charts i have created :).

ghost commented 11 years ago

OK, great. I'll try to implement that feature and let you know how it turns out.

bennacer860 commented 11 years ago

ok this is really cool, i will work tonight on: -Computing the mean absolute deviation to score the result -Create a dataset with fibonacci serie and test it

ghost commented 11 years ago

That would be nice. Before you do that, could you just wait before I play around with the code a bit, and add documentation to it and make it feel more like a library? It will only couple couple of minutes, you'll see what I mean.

bennacer860 commented 11 years ago

ok,take your time, i will work on it in a 5 hours :)

On Thu, Jun 20, 2013 at 1:55 PM, Rafal Chmiel notifications@github.comwrote:

That would be nice. Before you do that, could you just wait before I play around with the code a bit, and add documentation to it and make it feel more like a library? It will only couple couple of minutes, you'll see what I mean.

— Reply to this email directly or view it on GitHubhttps://github.com/bennacer860/benford_s_law/issues/3#issuecomment-19770621 .

ghost commented 11 years ago

Oh, okay.

bennacer860 commented 11 years ago

can you make a pull request please?

ghost commented 11 years ago

Will do, once I'm finished. Nearly done...

bennacer860 commented 11 years ago

cool

On Thu, Jun 20, 2013 at 2:44 PM, Rafal Chmiel notifications@github.comwrote:

Will do, once I'm finished.

— Reply to this email directly or view it on GitHubhttps://github.com/bennacer860/benford_s_law/issues/3#issuecomment-19774584 .