<jupyter_start><jupyter_text>New to Plotly?Plotly's Python library is free and open source! [Get started](https://plotly.com/python/getting-started/) by downloading the client and [reading the primer](https://plotly.com/python/getting-started/).You can set up Plotly to work in [online](https://plotly.com/python/getting-started/initialization-for-online-plotting) or [offline](https://plotly.com/python/getting-started/initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plotly.com/python/getting-started/start-plotting-online).We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!  Range of axes<jupyter_code>import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

N = 70
trace1 = go.Mesh3d(x=(70*np.random.randn(N)),
                   y=(55*np.random.randn(N)),
                   z=(40*np.random.randn(N)),
                   opacity=0.5,
                   color='rgba(244,22,100,0.6)'
                  )

layout = go.Layout(
                    scene = dict(
                    xaxis = dict(
                        nticks=4, range = [-100,100],),
                    yaxis = dict(
                        nticks=4, range = [-50,100],),
                    zaxis = dict(
                        nticks=4, range = [-100,100],),),
                    width=700,
                    margin=dict(
                    r=20, l=10,
                    b=10, t=10)
                  )
fig = go.Figure(data=[trace1], layout=layout)
py.iplot(fig, filename='3d-axis-range')<jupyter_output><empty_output><jupyter_text>Fixed Ratio Axes<jupyter_code>import plotly.plotly as py
import plotly.graph_objs as go
import plotly.tools as tls
import numpy as np

N = 50

fig = tls.make_subplots(
    rows=2, cols=2,
    specs=[
        [{'is_3d': True}, {'is_3d': True}],
        [{'is_3d': True}, {'is_3d': True}]
    ],
    print_grid=False
)
for i in [1,2]:
    for j in [1,2]:
        fig.append_trace(
            go.Mesh3d(
                x=(60*np.random.randn(N)),
                y=(25*np.random.randn(N)),
                z=(40*np.random.randn(N)),
                opacity=0.5,
              ), 
            row=i, col=j)

fig['layout'].update(go.Layout(
                    width=700,
                    margin=dict(
                    r=10, l=10,
                    b=10, t=10)
                  ))

# fix the ratio in the top left subplot to be a cube
fig['layout'][].update(go.Layout(
    go.layout.Scene(aspectmode='cube')),
    

# manually force the z-axis to appear twice as big as the other two
fig['layout']['scene2'].update(go.layout.Scene(
    aspectmode='manual',
    aspectratio=go.layout.scene.Aspectratio(
        x=1, y=1, z=2
    )
))

# draw axes in proportion to the proportion of their ranges
fig['layout']['scene3'].update(go.layout.Scene(aspectmode='data'))

# automatically produce something that is well proportioned using 'data' as the default
fig['layout']['scene4'].update(go.layout.Scene(aspectmode='auto'))

py.iplot(fig, filename='3d-axis-fixed-ratio-axes')<jupyter_output><empty_output><jupyter_text>Set Axes Title<jupyter_code>import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

N = 50
trace1 = go.Mesh3d(x=(60*np.random.randn(N)),
                   y=(25*np.random.randn(N)),
                   z=(40*np.random.randn(N)),
                   opacity=0.5,
                   color='yellow'
                  )
trace2 = go.Mesh3d(x=(70*np.random.randn(N)),
                   y=(55*np.random.randn(N)),
                   z=(30*np.random.randn(N)),
                   opacity=0.5,
                   color='pink'
                  )
layout = go.Layout(
                    scene = dict(
                    xaxis = dict(
                        title='X AXIS TITLE'),
                    yaxis = dict(
                        title='Y AXIS TITLE'),
                    zaxis = dict(
                        title='Z AXIS TITLE'),),
                    width=700,
                    margin=dict(
                    r=20, b=10,
                    l=10, t=10)
                  )
fig = go.Figure(data=[trace1,trace2], layout=layout)
py.iplot(fig, filename='3d-axis-titles')<jupyter_output><empty_output><jupyter_text>Ticks Formatting<jupyter_code>import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

N = 50
trace1 = go.Mesh3d(x=(60*np.random.randn(N)),
                   y=(25*np.random.randn(N)),
                   z=(40*np.random.randn(N)),
                   opacity=0.5,
                   color='rgba(100,22,200,0.5)'
                  )

layout = go.Layout(
                    scene = dict(
                    xaxis = dict(
                        ticktext= ['TICKS','MESH','PLOTLY','PYTHON'],
                        tickvals= [0,50,75,-50]),
                    yaxis = dict(
                        nticks=5, tickfont=dict(
                            color='green',
                            size=12,
                            family='Old Standard TT, serif',),
                        ticksuffix='#'),
                    zaxis = dict(
                        nticks=4, ticks='outside',
                        tick0=0, tickwidth=4),),
                    width=700,
                    margin=dict(
                    r=10, l=10,
                    b=10, t=10)
                  )
fig = go.Figure(data=[trace1], layout=layout)
py.iplot(fig, filename='3d-axis-tick-formatting')<jupyter_output><empty_output><jupyter_text>Background and Grid Color<jupyter_code>import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

N = 50
trace1 = go.Mesh3d(x=(30*np.random.randn(N)),
                   y=(25*np.random.randn(N)),
                   z=(30*np.random.randn(N)),
                   opacity=0.5,)


layout = go.Layout(
                    scene = dict(
                    xaxis = dict(
                         backgroundcolor="rgb(200, 200, 230)",
                         gridcolor="rgb(255, 255, 255)",
                         showbackground=True,
                         zerolinecolor="rgb(255, 255, 255)",),
                    yaxis = dict(
                        backgroundcolor="rgb(230, 200,230)",
                        gridcolor="rgb(255, 255, 255)",
                        showbackground=True,
                        zerolinecolor="rgb(255, 255, 255)"),
                    zaxis = dict(
                        backgroundcolor="rgb(230, 230,200)",
                        gridcolor="rgb(255, 255, 255)",
                        showbackground=True,
                        zerolinecolor="rgb(255, 255, 255)",),),
                    width=700,
                    margin=dict(
                    r=10, l=10,
                    b=10, t=10)
                  )
fig = go.Figure(data=[trace1], layout=layout)
py.iplot(fig, filename='3d-axis-background-and-grid-color')
from IPython.display import display, HTML

display(HTML('<link href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700" rel="stylesheet" type="text/css" />'))
display(HTML('<link rel="stylesheet" type="text/css" href="http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css">'))

! pip install git+https://github.com/plotly/publisher.git --upgrade
import publisher
publisher.publish(
    '3d-axes.ipynb', 'python/3d-axes/', 'Axes Formatting in 3d Plots | plotly',
    'How to format axes of 3d plots in Python with Plotly.',
    title = 'Format 3d Axes | plotly',
    name = '3D Axes',
    has_thumbnail='true', thumbnail='thumbnail/3d-axes.png', 
    language='python', page_type='example_index',
    display_as='3d_charts', order=0.101,
    ipynb= '~notebook_demo/96')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13636945119611105, 'fraction_numerical': 0.040552641678393245, 'mean_word_length': 1.7335664335664336, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '239841', 'license': 'CC-BY-3.0', 'n_tokens_mistral': 2688, 'n_tokens_neox': 2368, 'n_words': 453, 'path': '_posts/python-v3/3d/3d-axes/3d-axes.ipynb', 'repo_name': 'arauzo/graphing-library-docs', 'size': '7817'}