Ask Your Question
1

Plotting with logarithmic scaling for the 'x' axis?

asked 2012-06-24 10:14:21 +0100

anonymous user

Anonymous

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
5

answered 2012-06-24 17:28:46 +0100

calc314 gravatar image

updated 2012-06-24 17:44:06 +0100

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.

edit flag offensive delete link more

Comments

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.

kcrisman gravatar imagekcrisman ( 2012-06-25 12:46:08 +0100 )edit
3

answered 2012-08-03 08:05:49 +0100

v_2e gravatar image

updated 2012-08-04 15:45:17 +0100

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-06-24 10:14:21 +0100

Seen: 3,295 times

Last updated: Aug 04 '12