[racket] plot request/patch: independent control of y axis in density plots

From: John Clements (clements at brinckerhoff.org)
Date: Thu Mar 1 12:31:10 EST 2012

On Feb 29, 2012, at 5:54 PM, Neil Toronto wrote:

> On 02/29/2012 05:15 PM, John Clements wrote:
>> Plot's new "density" function is awesome. I'd like to add something to it, though; independent control of the y axis.
>> 
>> Here's the motivating scenario; I'm looking at server logs, to try to see which users are hammering the handin server hardest. Suppose I take a list of numbers representing the seconds on which a submission occurred.  I can plot the density of these using (density …), but what I get is the relative density, rather than the absolute density. In this case, I want the y axis to have the units "elements per unit time". This is different from an application such as the one in the docs where the number of data points is irrelevant.
>> 
>> This problem becomes much more acute when I'm trying to compare two different sets of server logs; the current behavior essentially normalizes w.r.t. the number of points.
>> 
>> The easiest way to fix this is just to allow the user to have independent control over the y scaling, so that you can for instance write:
>> 
>> (plot (density all-seconds 0.0625
>>                #:y-adjust (/ 1 (length all-seconds)))
>>       #:width 800)
>> 
>> to get a graph that shows density in hits per second.
> 
> If you're only plotting the density graph, you could currently do this:
> 
> (define scale (/ 1 (length all-seconds)))
> (parameterize ([plot-y-ticks  (ticks-scale (plot-y-ticks)
>                                           (linear-scale scale))])
>  (plot (density all-seconds 0.0625)))
> 
> 
> But you probably don't want to. First, some background.

I knew I'd get a good response if I gave you enough information.

Thanks!

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120301/a8ca0a69/attachment.p7s>

Posted on the users mailing list.