# Plotting with logarithmic scaling for the 'x' axis?

Hey! Would appreciate very much a bit of help:

I have an Array of data of Positions Vs. Time intervals, where Time goes from 0 to 10000, and every slot on the array represents a time interval of 100. The question is - is there any way to plot the data in the array using List_plot...show(), but with a logarithmic scaled 'x' axis ? Meaning - labels running as - 10^(-4), 10^(-3), ..., 10^5?

Thank you!

edit retag close merge delete

Sort by ยป oldest newest most voted

There is a ticket for such a thing at http://ask.sagemath.org/question/675/how-do-i-create-a-log-plot-of-line-data. From the notes there, it is not quite ready.

You can see the answer to a similar question at log-log plots.

Matplotlib has a LogFormatter that you also might be able to use, but I haven't got it working at the moment. It does not appear that using the tick_formatter in show will let you call this LogFormatter, but I might be missing something here.

more

1

Actually, http://trac.sagemath.org/sage_trac/ticket/4529 has positive review! Hopefully it will still apply on Sage 5.1. You are right that you have to be a little carefully about the formatters - see the patches at that ticket for more info.

( 2012-06-25 05:46:08 -0600 )edit

Since Sage 5.2 it's as simple as

list_plot(data_array, scale='semilogx') # Logarithmic scale for X-axis
list_plot(data_array, scale='semilogy') # Logarithmic scale for Y-axis
list_plot(data_array, scale='loglog') # Logarithmic scale for both axes

more