matplotlibplot3dmatplotlib-3d

Setting 3D-plot scale to logarithmic in Matplotlib giving an almost empty 2D plot


I'm trying to set the scale of a plot to logarithmic, using the code below. When plotting without the log scale, it gives me a correct plot.

for it, folder in enumerate(norm_folder_list):
    fig = plt.figure(figsize=(10, 8))
    ax = fig.add_subplot(111, projection='3d')
    ax.scatter(folder_data_real[it][0], folder_data_real[it][1], folder_data_real[it][2])

    
    ax.set_xlabel('Frequency')
    ax.set_ylabel('Time')
    ax.set_zlabel('Permittivity')


    ax.set_xscale('log')
    ax.set_yscale('log')
    ax.set_zscale('log')

However, the plot I am obtaining when using the log scale is as follows: Weird plot

I have never come across this, and can't seem to find anything about it online.

I tried plotting using different libraries, and the different libraries worked. However, for specific reasons, I need to use matplotlib3D for this.


Solution

  • This is a longstanding limitation of matplotlib, follow along with the feature request here: https://github.com/matplotlib/matplotlib/issues/209