Troy
Troy

Reputation: 548

How to get plotly to not ignore my axis settings?

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

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

Upvotes: 3

Views: 660

Answers (1)

Inon Peled
Inon Peled

Reputation: 711

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

Upvotes: 2

Related Questions