|
From: James R. V. Z. <jr...@co...> - 2007-07-27 02:05:13
|
Petr Mikulik <mi...@ph...> wrote:
> > I've just uploaded a patch that implements probability axes:
> > Probability axes simplify the presentation of certain kinds of data.
>
> It's just a particular scaling for one case. I would prefer Ethan's
> proposal:
>
> > > I would like to be able to do something like:
> > >
> > > set axis x1 x # will use for Energy
> > > set axis x2 k/x # will use for Wavelength
> > > set axis y1 log(y) # log scale value to be plotted
> > >
I would like to see a more general mechanism too. For the general
case, I would write something like
set axis x1 f(x) # how the x1 axis labels and tic marks relate
# to the "number being plotted"
set axis x2 g(x) # how the x2 axis labels and tic marks relate
# to the "number being plotted"
set x scale h(x) # how screen distances relate to the "number
# being plotted"
plot (k($1)):2 # how the "number being plotted" relates to the
# data in column 1 of the data file
For an ordinary linear plot: f(x) = g(x) = h(x) = x
For a log scale: f(x) = g(x) = x
h(x) = log10(x)
For probability scaling: f(x) = g(x) = x
h(x) = inverse_normal_func(x)
One tricky part is placing the tic marks and labels if f(h(x)) or
g(h(x)) is nonlinear. That's what my code in transform.c does.
The other tricky part is actually allowing the user to define the
functions. I know the expression parsing and function evaluation is
in gnuplot, but I have not been able to hook that up to my code. I'm
hoping one of the other developers will consider that an easy job :-)
There are two more issues:
1) The range of validity for log scaling is hard-coded in, of course.
I did the same thing for probability scaling. If we let the user
define a function, I think we'll have to let him define its range of
validity too. That holds for each of the functions f(), g(), and h().
So for Ethan's wavelength scale we would have something like
set axis x1 x
set axis x2 k/x valid x>0
set x scale log(x) valid x>0
or for probabilty scales
set x scale inverse_normal_func(x) valid ((0<x) && (x<1))
2) For either linear or log scales, gnuplot can "round out" the plot
range so it can put a labeled tic mark at each end of the axis. If
the two axes are related by a function, then we cannot generally do
that. (A user-defined function may not even be defined outside the
range of the data provided.) My code does not round out.
> > > Even better if there is a way to automatically lock x1 to x2, so that
> > > they are forced to span the same range.
I don't follow this. It looks to me that Ethan's syntax does force
the two axes to span the same range.
- Jim Van Zandt
|