3
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)

import numpy as np

x, y, z = np.random.multivariate_normal(np.array([0,0,0]), np.eye(3), 200).transpose()
trace1 = go.Scatter3d(
    x=x,
    y=y,
    z=z,
    mode='markers',
    marker=dict(
        size=12,
        line=dict(
            color='rgba(217, 217, 217, 0.14)',
            width=0.5
        ),
        opacity=0.8
    )
)

data = [trace1]
layout = go.Layout(
    margin=dict(
        l=0,
        r=0,
        b=0,
        t=0
    ),
    xaxis=dict(type='log',
               autorange=True,
               title="L1")
)
fig = go.Figure(data=data, layout=layout)
iplot(fig, filename='simple-3d-scatter')

This is an example from the docs, https://plot.ly/python/3d-scatter-plots/ that I slightly modified to

  • make the xaxis log scale (following this) and
  • change the x axis label (following this)

However, Plotly seems to be (silently) ignoring my axis settings, as I am getting this and not getting any errors/warnings:

enter image description here

which you might notice, is neither log scale nor the L1 axis label that I want it to have.

How do I fix this? Python 3.6.8, Plotly version 3.6.1, plotting in Jupyter notebook (offline mode).


Trying with plotly 3.3 in a virtualenv:

enter image description here

2
  • Try to create a virtualenv in Plotly with version 2.7 or 3.3. (plot.ly/python/getting-started). Plotly using virtualenv Commented Apr 1, 2019 at 2:51
  • @RajMehta Nope, doesn't work with plotly3.3 Commented Apr 1, 2019 at 3:17

1 Answer 1

2

Specify axis attributes within a scene dict, as following:

layout = go.Layout(
    margin=dict(
        l=0,
        r=0,
        b=0,
        t=0
    ),
    scene=dict(
        xaxis=dict(
           type='log',
           autorange=True,
           title='L1')
    )
)

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

thanks that works. not quite sure what this isn't mentioned in the docs or I'm just blind.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.