Ask Your Question

Revision history [back]

You could rescale the data before you plot it:

sage: data = [(t^2,t^3) for t in srange(1,10,.1)]
sage: L = line2d(data)
sage: L.show(figsize=[5,2])

linear plot

sage: log_data = [(log(x[0]),log(x[1])) for x in data]
sage: M = line2d(log_data)
sage: M.show(figsize=[5,2])

log plot

If you want the tick marks to be logarithmic, the docstring for M.show describes an option for using a matplotlib tick "locator".

sage: from matplotlib import ticker
sage: tloc = lambda m: ticker.LogLocator(subs=[m])
sage: M.show(figsize=[5,2],ticks=(tloc(4),tloc(1)))

log plot with log ticks

To be honest though, I had a lot of trouble using the LogLocator -- it doesn't seem completely polished, and may take a while to understand.