prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Top Half of Seaborn Chart Title Gets Cut Off
  # Summary
  When adding a title to a seaborn or perhaps MATPLOTLIB chart (have not tested with MATPLOTLIB yet) chart, the top half of the title is cut off or not displayed
  
  ```
  # Steps to reproduce
  import matplotlib.pyplot as plt
  import seaborn as sns
  import streamlit as st
  
  mpg = sns.load_dataset("mpg")
  option = st.sidebar.multiselect('Choose country of origin:', mpg.origin.unique()
  sns.relplot(x="horsepower", y="mpg", hue="origin", size="weight", sizes=(40, 400), alpha=0.5, palette="muted", height=6, data=mpg.query("origin == @option"))
  plt.title('MPG vs Weight by Country of Origin')
  st.pyplot()
  ```
  
  ## Expected behavior:
  seaborn chart title to be fully visible
  
  ## Actual behavior:
  Top half of seaborn chart title is cut off
  
  ## Is this a regression?
  That is, did this use to work the way you expected in the past?  First time using streamlit, so not sure if worked in the past
  yes?  maybe?
  
  # Debug info
  - Streamlit version: 0.47.4
  - Python version: 3.7
  - Using Conda
  - OS version: Windows 10
  - Browser version: Chrome version 77
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/streamlit/elements/pyplot.py`
  Content:
  ```
  1 # Copyright 2018-2020 Streamlit Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #    http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 """Streamlit support for Matplotlib PyPlot charts."""
  16 
  17 import io
  18 
  19 try:
  20     import matplotlib  # noqa: F401
  21     import matplotlib.pyplot as plt
  22 
  23     plt.ioff()
  24 except ImportError:
  25     raise ImportError("pyplot() command requires matplotlib")
  26 
  27 import streamlit.elements.image_proto as image_proto
  28 
  29 from streamlit.logger import get_logger
  30 
  31 LOGGER = get_logger(__name__)
  32 
  33 
  34 def marshall(coordinates, new_element_proto, fig=None, clear_figure=True, **kwargs):
  35     """Construct a matplotlib.pyplot figure.
  36 
  37     See DeltaGenerator.vega_lite_chart for docs.
  38     """
  39     # You can call .savefig() on a Figure object or directly on the pyplot
  40     # module, in which case you're doing it to the latest Figure.
  41     if not fig:
  42         if clear_figure is None:
  43             clear_figure = True
  44         fig = plt
  45 
  46     # Normally, dpi is set to 'figure', and the figure's dpi is set to 100.
  47     # So here we pick double of that to make things look good in a high
  48     # DPI display.
  49     options = {"dpi": 200, "format": "png"}
  50 
  51     # If some of the options are passed in from kwargs then replace
  52     # the values in options with the ones from kwargs
  53     options = {a: kwargs.get(a, b) for a, b in options.items()}
  54     # Merge options back into kwargs.
  55     kwargs.update(options)
  56 
  57     image = io.BytesIO()
  58     fig.savefig(image, **kwargs)
  59     image_proto.marshall_images(
  60         coordinates,
  61         image,
  62         None,
  63         -2,
  64         new_element_proto.imgs,
  65         False,
  66         channels="RGB",
  67         format="PNG",
  68     )
  69 
  70     # Clear the figure after rendering it. This means that subsequent
  71     # plt calls will be starting fresh.
  72     if clear_figure:
  73         fig.clf()
  74
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/streamlit/elements/pyplot.py b/lib/streamlit/elements/pyplot.py
  --- a/lib/streamlit/elements/pyplot.py
  +++ b/lib/streamlit/elements/pyplot.py
  @@ -46,7 +46,7 @@
       # Normally, dpi is set to 'figure', and the figure's dpi is set to 100.
       # So here we pick double of that to make things look good in a high
       # DPI display.
  -    options = {"dpi": 200, "format": "png"}
  +    options = {"bbox_inches": "tight", "dpi": 200, "format": "png"}
   
       # If some of the options are passed in from kwargs then replace
       # the values in options with the ones from kwargs
  
verification_info: {"golden_diff": "diff --git a/lib/streamlit/elements/pyplot.py b/lib/streamlit/elements/pyplot.py\n--- a/lib/streamlit/elements/pyplot.py\n+++ b/lib/streamlit/elements/pyplot.py\n@@ -46,7 +46,7 @@\n     # Normally, dpi is set to 'figure', and the figure's dpi is set to 100.\n     # So here we pick double of that to make things look good in a high\n     # DPI display.\n-    options = {\"dpi\": 200, \"format\": \"png\"}\n+    options = {\"bbox_inches\": \"tight\", \"dpi\": 200, \"format\": \"png\"}\n \n     # If some of the options are passed in from kwargs then replace\n     # the values in options with the ones from kwargs\n", "issue": "Top Half of Seaborn Chart Title Gets Cut Off\n# Summary\r\nWhen adding a title to a seaborn or perhaps MATPLOTLIB chart (have not tested with MATPLOTLIB yet) chart, the top half of the title is cut off or not displayed\r\n\r\n```\r\n# Steps to reproduce\r\nimport matplotlib.pyplot as plt\r\nimport seaborn as sns\r\nimport streamlit as st\r\n\r\nmpg = sns.load_dataset(\"mpg\")\r\noption = st.sidebar.multiselect('Choose country of origin:', mpg.origin.unique()\r\nsns.relplot(x=\"horsepower\", y=\"mpg\", hue=\"origin\", size=\"weight\", sizes=(40, 400), alpha=0.5, palette=\"muted\", height=6, data=mpg.query(\"origin == @option\"))\r\nplt.title('MPG vs Weight by Country of Origin')\r\nst.pyplot()\r\n```\r\n\r\n## Expected behavior:\r\nseaborn chart title to be fully visible\r\n\r\n## Actual behavior:\r\nTop half of seaborn chart title is cut off\r\n\r\n## Is this a regression?\r\nThat is, did this use to work the way you expected in the past?  First time using streamlit, so not sure if worked in the past\r\nyes?  maybe?\r\n\r\n# Debug info\r\n- Streamlit version: 0.47.4\r\n- Python version: 3.7\r\n- Using Conda\r\n- OS version: Windows 10\r\n- Browser version: Chrome version 77\r\n\n", "before_files": [{"content": "# Copyright 2018-2020 Streamlit Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Streamlit support for Matplotlib PyPlot charts.\"\"\"\n\nimport io\n\ntry:\n    import matplotlib  # noqa: F401\n    import matplotlib.pyplot as plt\n\n    plt.ioff()\nexcept ImportError:\n    raise ImportError(\"pyplot() command requires matplotlib\")\n\nimport streamlit.elements.image_proto as image_proto\n\nfrom streamlit.logger import get_logger\n\nLOGGER = get_logger(__name__)\n\n\ndef marshall(coordinates, new_element_proto, fig=None, clear_figure=True, **kwargs):\n    \"\"\"Construct a matplotlib.pyplot figure.\n\n    See DeltaGenerator.vega_lite_chart for docs.\n    \"\"\"\n    # You can call .savefig() on a Figure object or directly on the pyplot\n    # module, in which case you're doing it to the latest Figure.\n    if not fig:\n        if clear_figure is None:\n            clear_figure = True\n        fig = plt\n\n    # Normally, dpi is set to 'figure', and the figure's dpi is set to 100.\n    # So here we pick double of that to make things look good in a high\n    # DPI display.\n    options = {\"dpi\": 200, \"format\": \"png\"}\n\n    # If some of the options are passed in from kwargs then replace\n    # the values in options with the ones from kwargs\n    options = {a: kwargs.get(a, b) for a, b in options.items()}\n    # Merge options back into kwargs.\n    kwargs.update(options)\n\n    image = io.BytesIO()\n    fig.savefig(image, **kwargs)\n    image_proto.marshall_images(\n        coordinates,\n        image,\n        None,\n        -2,\n        new_element_proto.imgs,\n        False,\n        channels=\"RGB\",\n        format=\"PNG\",\n    )\n\n    # Clear the figure after rendering it. This means that subsequent\n    # plt calls will be starting fresh.\n    if clear_figure:\n        fig.clf()\n", "path": "lib/streamlit/elements/pyplot.py"}], "after_files": [{"content": "# Copyright 2018-2020 Streamlit Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Streamlit support for Matplotlib PyPlot charts.\"\"\"\n\nimport io\n\ntry:\n    import matplotlib  # noqa: F401\n    import matplotlib.pyplot as plt\n\n    plt.ioff()\nexcept ImportError:\n    raise ImportError(\"pyplot() command requires matplotlib\")\n\nimport streamlit.elements.image_proto as image_proto\n\nfrom streamlit.logger import get_logger\n\nLOGGER = get_logger(__name__)\n\n\ndef marshall(coordinates, new_element_proto, fig=None, clear_figure=True, **kwargs):\n    \"\"\"Construct a matplotlib.pyplot figure.\n\n    See DeltaGenerator.vega_lite_chart for docs.\n    \"\"\"\n    # You can call .savefig() on a Figure object or directly on the pyplot\n    # module, in which case you're doing it to the latest Figure.\n    if not fig:\n        if clear_figure is None:\n            clear_figure = True\n        fig = plt\n\n    # Normally, dpi is set to 'figure', and the figure's dpi is set to 100.\n    # So here we pick double of that to make things look good in a high\n    # DPI display.\n    options = {\"bbox_inches\": \"tight\", \"dpi\": 200, \"format\": \"png\"}\n\n    # If some of the options are passed in from kwargs then replace\n    # the values in options with the ones from kwargs\n    options = {a: kwargs.get(a, b) for a, b in options.items()}\n    # Merge options back into kwargs.\n    kwargs.update(options)\n\n    image = io.BytesIO()\n    fig.savefig(image, **kwargs)\n    image_proto.marshall_images(\n        coordinates,\n        image,\n        None,\n        -2,\n        new_element_proto.imgs,\n        False,\n        channels=\"RGB\",\n        format=\"PNG\",\n    )\n\n    # Clear the figure after rendering it. This means that subsequent\n    # plt calls will be starting fresh.\n    if clear_figure:\n        fig.clf()\n", "path": "lib/streamlit/elements/pyplot.py"}]}