Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: histogram

by alperyilmaz (Initiate)
on Nov 19, 2009 at 17:18 UTC ( #808215=note: print w/replies, xml ) Need Help??

in reply to histogram

i want to add option ASCII stars, to make it graphical, like this: -a|--ascii <num of stars> In this case, let's say I want 100 stars maximum.. what number do i need to divide the numeric values to get number of stars per lane? thanks,

Replies are listed 'Best First'.
Re^2: histogram
by polettix (Vicar) on Nov 23, 2009 at 23:45 UTC

    if you always want your highest category to be represented by 100 stars, you have to normalise all the values multiplying by 100 / $max_value, like this (around line 98):

    if ($config{ascii}) { require List::Util; my $max_value = List::Util::max(@frequencies); for my $index (0 .. $#frequencies) { my $length = $frequencies[$index] * $config{ascii} / $max_value; print {*STDOUT} $labels[$index], "\t", '*' x $length, "\n"; } exit 0; }
    Of course, you have to add the option at the beginning.

    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Io ho capito... ma tu che hai detto?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://808215]
[Corion]: Hi jedikaiti!
[Cosmic37]: is there a webpage for full CB for this chat rather than side panel chat?
[Cosmic37]: thank you for advice
[Cosmic37]: peach greets jedi
[Cosmic37]: ok this one works better fullpage chat
[Cosmic37]: test
[Cosmic37]: sort of anyway... hurls some peaches... :-D

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2017-06-29 16:24 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (672 votes). Check out past polls.