problem plotting on logscale in matplotlib in python

Posted by user248237 on Stack Overflow See other posts from Stack Overflow or by user248237
Published on 2010-04-23T01:18:53Z Indexed on 2010/04/23 1:23 UTC
Read the original article Hit count: 386

Filed under:
|
|
|
|

I am trying to plot the following numbers on a log scale as a scatter plot in matplotlib. Both the quantities on the x and y axes have very different scales, and one of the variables has a huge dynamic range (nearly 0 to 12 million roughly) while the other is between nearly 0 and 2. I think it might be good to plot both on a log scale.

I tried the following, for a subset of the values of the two variables:

fig = plt.figure(figsize(8, 8))
ax = fig.add_subplot(1, 1, 1)
ax.set_yscale('log')
ax.set_xscale('log')
plt.scatter([1.341, 0.1034, 0.6076, 1.4278, 0.0374],
        [0.37, 0.12, 0.22, 0.4, 0.08])

The x-axes appear log scaled but the points do not appear -- only two points appear. Any idea how to fix this? Also, how can I make this log scale appear on a square axes, so that the correlation between the two variables can be interpreted from the scatter plot?

thanks.

© Stack Overflow or respective owner

Related posts about numpy

Related posts about scipy