Not able to hide axis labels

I am using Dash+Plotly+Python and I am struggling to hide the axis labels. I have tried a lot of variations but with no luck.

Code snippets are below :

app.layout = html.Div([ dcc.Graph(
id = ‘scatter1’,
figure = {‘data’ : [
go.Scatter(
x = data_cleaned.service_route_path,
y = data_cleaned.mean_time_spent,
mode = “markers”,
name = “Mean Duration”,
marker = dict(color = ‘rgba(0, 255, 200, 0.8)’)#,
#text = data_cleaned.mean_time_spent
)

‘layout’ : {
‘title’ : ‘Mean Vs Median Time Spent’,
#‘autosize’: ‘false’,
#‘width’:‘1200’,
#‘height’:‘400’,
#‘showlegend’:‘False’,
#‘margin’:{
# ‘l’:‘80’,
# ‘r’:‘50’,
# ‘t’:‘110’,
# ‘b’:‘100’
#},
‘xaxis’:{ ‘showgrid’:‘False’,
‘zeroline’:‘False’,
‘showline’:‘False’,
‘visible’:‘False’,
‘showticklabels’:‘False’
#‘tickangle’ : ‘45’
# ‘tickfont’: {
# ‘family’: ‘Old Standard TT, serif’,
# ‘size’: ‘10’,
# ‘color’: ‘black’
# }

                                                    },
                                            'yaxis':{'type':'log',
                                                    'showgrid':'False',
                                                        'zeroline':'False',
                                                        'showline':'False',
                                                        'ticks':'',
                                                        'showticklabels':'False'}

You can try changing your layout to similar to what’s in the code below. (Also can you enclose your code in ``` next time you ask a question so it’s easier to read?)

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go

app = dash.Dash()

data = [go.Scatter(
    x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
    y=[8, 7, 6, 5, 4, 3, 2, 1, 0]
)]
layout = go.Layout(
    xaxis=dict(
        autorange=True,
        showgrid=False,
        ticks='',
        showticklabels=False
    ),
    yaxis=dict(
        autorange=True,
        showgrid=False,
        ticks='',
        showticklabels=False
    )
)

app.layout = html.Div(children=[
    dcc.Graph(figure = {'data':data, 'layout':layout})
])

if __name__ == '__main__':
    app.run_server(debug=True)
2 Likes