✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Increase figure space without making plot bigger

Hi,
I was try to add a note to the bottom of a plot, but it gets cropped, because there’s no more space for the note to appear, like this:

I tried using height, but this just makes the plot bigger without adding space outside of it. Also tried with margins and padding, but they don’t seem to work either. So, I guess there’s another way I’m missing. Any ideas? Anyways here’s some functional code to reproduce my problem:


import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objects as go
from dash.dependencies import Input, Output


app = dash.Dash(__name__)
server = app.server

df = pd.DataFrame(pd.DataFrame({'country': {0: 'Iceland',
  1: 'Bahrain',
  2: 'Norway',
  3: 'Estonia',
  4: 'Switzerland',
  5: 'Israel',
  6: 'Slovenia'},
 'test_million': {0: 102658.70704717531,
  1: 42367.37939352402,
  2: 23969.44609101287,
  3: 23037.322451160784,
  4: 22929.918218991366,
  5: 17042.22280880952,
  6: 16865.661240773756}}))


country_options = [{'label': i, 'value': i} for i in df.country.unique()]

def plot_tests():
    dte = df.sort_values('test_million', ascending=False)[['country', 'test_million']].head(5)
    fig = go.Figure()
    fig.add_trace(go.Bar(x=dte['country'], y=dte['test_million']))
    fig.update_layout(annotations= [dict(
                              x=0.0,
                              y=-0.32,
                              showarrow=False,
                              text="<b>Note</b>: Lorem ipsum .",
                              xref="paper",
                              yref="paper")])
    return fig

app.layout = html.Div(children=[
    # Títulos

    # Gráfico testeos
    html.Div(dcc.Dropdown(id='filter-tests',
                          options=country_options,
                          value=['Iceland'],
                          multi=True
                          )),
    dcc.Graph(id='tests', figure=plot_tests())
    ])





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