Hi all,

I wonder if there is a way to change the base used to calculate the
logarithmic mapping for graph.axis.logarithmic?

I have some random points generated uniformly on [0, 1] and then
mapped using an exponential function (which I'll paste in at the end
-- there is a factor of k which might seem strange but this mapping is
used by a trusted example in my problem domain!)

When I graph these points in PyX, they don't appear uniform on the
X-axis: if it's a linear axis, they are bunched on the left; if it's a
logarithmic axis, they are bunched on the right. I think if I could
set the base for the log axis to k, I could get the right result?

James

-- 
James McDermott
PhD candidate in Music Technology
CSG026,
Dept. Computer Science and Information Systems,
University of Limerick,
Ireland.
www.skynet.ie/~jmmcd

--
Here's an example program which demonstrates my problem:

--
#!/usr/bin/env python

from pyx import *
import random
import math

# map x from [0, 1] to [minv, maxv]
def exp_map(minv, maxv, x):
    k = 5.0
    return minv + (maxv - minv) * ((math.exp(k * x) - 1) / (math.exp(k) - 1))

r = [(exp_map(0.0, 10.0, random.random()), random.random())
     for i in range(100)]

xaxes = [("lin", graph.axis.lin()), ("log", graph.axis.log())]

for name, xaxis in xaxes:
    g = graph.graphxy(width=6, x=xaxis)
    g.plot(graph.data.list(r, x=1, y=2))
    g.writeEPSfile(name)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to