|
From: James R. V. Z. <jr...@co...> - 2009-05-25 02:37:23
|
Dean Foster <dea...@gm...> wrote: > I've been working on adding some other transformations to > gnuplot. I needed them for some research I was doing, and thought > they might be of general interest. The idea is to have a variety of > ways to transform the axis. Currently gnuplot supports linear and > log. I've been looking for that functionality for some time, and I wrote the previous version. The patch Hans-Bernhard Broeker and Ethan Merritt pointed out integrated a single added transform (the "probability" transform, that makes normally distributed values appear on a straight line) into gnuplot. I followed the philosophy of changing the existing structure as little as possible (AKA "do no harm"). However, Ethan thought that was perpetuating a design error, and would rather fix the design first. I agree the design he describes would be better. However, nobody has made progress on it. Although my patch only implements the probability transform, I spent a fair amount of time on automatic placement of tic marks and labels for a general transform, based on the following principles: - Place no tics or minitics outside the range specified by the user. - Don't allow tic labels to overlap. - Choose the "simplest" tics to label (i.e. those with the fewest significant digits). - Subject to the above, place tics with approximately even density. - Ensure the value corresponding to each minitic is obvious. - Subject to the above, place enough minitics that the user can easily interpolate to find the value for any point on the graph. Several simple approaches failed, but eventually I got it working fairly well. You can see a couple of examples at http://jrv.oddones.org/ . For more examples, download http://jrv.oddones.org/transform-1.0.tar.gz, unpack, and build with "make plots". The code generates a piecewise rational fit to the transform function, so it can be used where there is no closed form for the inverse transform. One issue I had not solved has to do with limits. For a log transform, data points that are zero or negative should be dropped. For a probability transform, data points outside (0,1) should be dropped. How should this be handled for a user-supplied transform? Do we ask the user to supply the appropriate limits? (Do we trust him?) Do we try to evaluate the transform, and check for NANs? I'd look forward to working on this. - Jim Van Zandt |