Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matplotlib, 3D logaxis, incomplete figure

I am playing with matplotlib, I would like to have a 3d figure with logarithmic axis. I was trying some code, like the one below, but I can only see part of the figure at a time, if I try to move it, I can see other parts, but, not complete.

Does anyone have any idea how to make a 3D plot with log axis?

I can see the 3D image if the axis are linear, but as soon as I change to "log", I can only see part of it.

import matplotlib as mpl
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt   
data=np.array([[1,10,100],[10,1,1],[2,20,82]])
fig=plt.figure()
ax=Axes3D(fig)
#ax.set_xlim3d(0.1,15)
#ax.set_ylim3d(0.1,15)
#ax.set_zlim3d(0.1,15)
ax.xaxis.set_scale('log')
ax.yaxis.set_scale('log')
ax.zaxis.set_scale('log')
ax.scatter(data[:,0],data[:,1],data[:,2])
plt.show()
like image 400
joc Avatar asked Aug 09 '26 07:08

joc


1 Answers

I updated matplotlib to 1.3.1, and now I can see the full figure. Now, I think the axis are not in a log scale. I made a plot in matplotlib matplotlib and the same plot with gnuplot gnuplot, and it can be seen that the distances between every power of 10, are comlpetely different.

like image 75
joc Avatar answered Aug 10 '26 21:08

joc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!