title: Plotly: How to adjust the space between axis labels and plot area?
body: <p>How can I adjust space between axis labels and plot area in Plotly? In particularly I am interesting in decreasing space between axis labels and plot area. I've attached a screenshot with an example.</p>
  <p><a href="https://i.stack.imgur.com/w4yi1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/w4yi1.png" alt="enter image description here" /></a></p>
  <p>Here is reproducible code snippet:</p>
  <pre><code>import dash
  import dash_core_components as dcc
  import dash_html_components as html
  import plotly.graph_objs as go
  import plotly.express as px
  import pandas as pd
  import numpy as np
  
  external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
  
  app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
  
  
  df = pd.read_csv(&quot;data.txt&quot;, sep='\t', parse_dates=[&quot;StartTimeRun&quot;, &quot;EndTimeRun&quot;])
  df = df[df['Status'] != 'NOT_RUN']
  df = df[df['Status2'] != 'NOT_RUN']
  
  # assume you have a &quot;long-form&quot; data frame
  # see https://plotly.com/python/px-arguments/ for more options
  df_PASS = df.loc[df['Status'] == &quot;PASS&quot;]
  df_FAIL = df.loc[df['Status'] == &quot;FAIL&quot;]
  trace1 = go.Box(x=df_PASS[&quot;Duration(seconds)&quot;], y=df_PASS[&quot;Keyword&quot;], name=&quot;PASS&quot;, orientation='h', marker=dict(color='rgb(158,202,225)', line=dict(color='rgb(8,48,107)', width=1.5)))
  trace2 = go.Box(x=df_FAIL[&quot;Duration(seconds)&quot;], y=df_FAIL[&quot;Keyword&quot;], name=&quot;FAIL&quot;, orientation='h', marker=dict(color='#fd9668', line=dict(color='rgb(8,48,107)', width=1.5)))
  fig = {
      'data': [trace1, trace2],
      'layout':
      go.Layout(
          boxmode='group',  margin=dict(l=200, r=150)
      )
  }
  
  app.layout = html.Div(children=[
      html.H1(children='Hello Dash'),
  
      html.Div(children='''
          Dash: A web application framework for Python.
      '''),
  
      dcc.Graph(
          id='example-graph',
          figure=fig
      )
  ])
  
  if __name__ == '__main__':
      app.run_server(debug=True)
  </code></pre>
  <p>And here is the dataframe (data.txt):</p>
  <pre><code>SuiteName   Test    Status  Keyword Status2 Duration(seconds)   StartTimeRun    EndTimeRun  Type    FileName
  0SmokeTestDD    Validate the use case for Single UE PASS    BuiltIn.Run Keywords    FAIL    12.619  20200809 06:45:18.515   20200809 06:45:31.134   setup   output-20200809-064513.xml
  0SmokeTestDD    Validate the use case for Single UE PASS    Validate the work flow  PASS    34.56   20200809 06:45:31.135   20200809 06:49:25.695   kw  output-20200809-064513.xml
  0SmokeTestDD    Validate the use case for Single UE PASS    BuiltIn.Run Keywords    PASS    15.344  20200809 06:49:25.695   20200809 06:49:41.039   teardown    output-20200809-064513.xml
  Validate the use case for Single UE Validate the work flow  PASS    Login To    FAIL    8.502   20200809 06:45:31.135   20200809 06:45:39.637   kw  output-20200809-064513.xml
  Validate the use case for Single UE Validate the work flow  PASS    Select Technology   PASS    1.243   20200809 06:45:39.637   20200809 06:45:55.880   kw  output-20200809-064513.xml
  Validate the use case for Single UE Validate the work flow  PASS    Select Menu PASS    7.147   20200809 06:45:55.880   20200809 06:46:03.027   kw  output-20200809-064513.xml
  Validate the use case for Single UE Validate the work flow  PASS    BuiltIn.Log FAIL    0.001   20200809 06:46:03.027   20200809 06:46:03.028   kw  output-20200809-064513.xml
  Validate the use case for Single UE Validate the work flow  PASS    BuiltIn.Sleep   PASS    5.0 20200809 06:46:03.028   20200809 06:46:08.028   kw  output-20200809-064513.xml
  </code></pre>
  <p>Hope this snippet will help to find answer.</p>