We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Plotly charts ignore HEIGHT attribute after bug fix #5645
### Checklist

- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.

### Summary

When defining a chart with Plotly Express, you can provide a HEIGHT attribute defining.
Before bugfix #5645 this worked, but after this bugfix now the HEIGHT is ignored.


### Reproducible Code Example

[![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlitapp.com/?issue=gh-5749)

```Python
import streamlit as st
import pandas as pd
import plotly.express as px

data = pd.DataFrame((100,120,104,102,203,102),columns=["some_col"])

fig = px.line(data, height=100, width=200)
fig.update_xaxes(visible=False, fixedrange=True)
fig.update_yaxes(visible=False, fixedrange=True)
fig.update_layout(annotations=[], overwrite=True)
fig.update_layout(
  showlegend=False,
  plot_bgcolor="white",
  margin=dict(t=10,l=10,b=10,r=10)
  )
st.plotly_chart(fig,config=dict(displayModeBar=False))
```


### Steps To Reproduce

_No response_

### Expected Behavior

_No response_

### Current Behavior

_No response_

### Is this a regression?

- [X] Yes, this used to work in a previous version.

### Debug info

- Streamlit version: 1.15.
- Python version: 3.10
- Operating System: Win 10
- Browser: Edge
- Virtual environment:


### Additional Information

_No response_

### Are you willing to submit a PR?

- [ ] Yes, I am willing to submit a PR!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `e2e/scripts/st_plotly_chart.py`
Content:
```
1 # Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
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 from datetime import datetime
16 
17 import numpy as np
18 import plotly.express as px
19 import plotly.figure_factory as ff
20 import plotly.graph_objects as go
21 from plotly.subplots import make_subplots
22 
23 import streamlit as st
24 
25 # Explicitly seed the RNG for deterministic results
26 np.random.seed(0)
27 
28 df_bubble = px.data.gapminder()
29 fig_bubble = px.scatter(
30     df_bubble.query("year==2007"),
31     x="gdpPercap",
32     y="lifeExp",
33     size="pop",
34     color="continent",
35     hover_name="country",
36     log_x=True,
37     size_max=60,
38 )
39 
40 # tests no streamlit theme plot
41 st.plotly_chart(fig_bubble, theme=None)
42 
43 # Bubble Chart
44 # Tests Discrete coloring with streamlit theme
45 st.plotly_chart(fig_bubble, theme="streamlit")
46 
47 # Candlestick Chart
48 open_data_candlestick = [33.0, 33.3, 33.5, 33.0, 34.1]
49 high_data_candlestick = [33.1, 33.3, 33.6, 33.2, 34.8]
50 low_data_candlestick = [32.7, 32.7, 32.8, 32.6, 32.8]
51 close_data_candlestick = [33.0, 32.9, 33.3, 33.1, 33.1]
52 dates_candlestick = [
53     datetime(year=2013, month=10, day=10),
54     datetime(year=2013, month=11, day=10),
55     datetime(year=2013, month=12, day=10),
56     datetime(year=2014, month=1, day=10),
57     datetime(year=2014, month=2, day=10),
58 ]
59 fig_candlestick = go.Figure(
60     data=[
61         go.Candlestick(
62             x=dates_candlestick,
63             open=open_data_candlestick,
64             high=high_data_candlestick,
65             low=low_data_candlestick,
66             close=close_data_candlestick,
67         )
68     ]
69 )
70 st.plotly_chart(fig_candlestick, theme="streamlit")
71 
72 # Tests sunburst charts and color parameter using streamlit colors
73 df = px.data.tips()
74 fig_sunburst = px.sunburst(
75     df, path=["sex", "day", "time"], values="total_bill", color="day"
76 )
77 st.plotly_chart(fig_sunburst, theme="streamlit")
78 
79 # Contour Plot and Heatmap
80 fig = make_subplots(
81     rows=2, cols=2, subplot_titles=("connectgaps = False", "connectgaps = True")
82 )
83 z = [
84     [None, None, None, 12, 13, 14, 15, 16],
85     [None, 1, None, 11, None, None, None, 17],
86     [None, 2, 6, 7, None, None, None, 18],
87     [None, 3, None, 8, None, None, None, 19],
88     [5, 4, 10, 9, None, None, None, 20],
89     [None, None, None, 27, None, None, None, 21],
90     [None, None, None, 26, 25, 24, 23, 22],
91 ]
92 
93 fig.add_trace(go.Contour(z=z, showscale=False), 1, 1)
94 fig.add_trace(go.Contour(z=z, showscale=False, connectgaps=True), 1, 2)
95 fig.add_trace(go.Heatmap(z=z, showscale=False, zsmooth="best"), 2, 1)
96 fig.add_trace(go.Heatmap(z=z, showscale=False, connectgaps=True, zsmooth="best"), 2, 2)
97 
98 fig["layout"]["yaxis1"].update(title="Contour map")
99 fig["layout"]["yaxis3"].update(title="Heatmap")
100 
101 st.plotly_chart(fig, theme="streamlit")
102 
103 # Waterfall Chart
104 fig_waterfall = go.Figure(
105     go.Waterfall(
106         name="20",
107         orientation="v",
108         measure=["relative", "relative", "total", "relative", "relative", "total"],
109         x=[
110             "Sales",
111             "Consulting",
112             "Net revenue",
113             "Purchases",
114             "Other expenses",
115             "Profit before tax",
116         ],
117         textposition="outside",
118         text=["+60", "+80", "", "-40", "-20", "Total"],
119         y=[60, 80, 0, -40, -20, 0],
120         connector={"line": {"color": "rgb(63, 63, 63)"}},
121     )
122 )
123 
124 fig_waterfall.update_layout(title="Profit and loss statement 2018", showlegend=True)
125 st.plotly_chart(fig_waterfall, theme="streamlit")
126 
127 # Ternary Chart
128 df = px.data.election()
129 fig_ternary = px.scatter_ternary(df, a="Joly", b="Coderre", c="Bergeron")
130 
131 st.plotly_chart(fig_ternary, theme="streamlit")
132 
133 # Table Plot
134 fig_table = go.Figure(
135     data=[
136         go.Table(
137             header=dict(values=["A Scores", "B Scores"]),
138             cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]),
139         )
140     ]
141 )
142 st.plotly_chart(fig_table, theme="streamlit")
143 
144 # Continuous Customization Chart with plotly.go graph
145 fig_contour = go.Figure(
146     data=go.Contour(
147         z=[
148             [10, 10.625, 12.5, 15.625, 20],
149             [5.625, 6.25, 8.125, 11.25, 15.625],
150             [2.5, 3.125, 5.0, 8.125, 12.5],
151             [0.625, 1.25, 3.125, 6.25, 10.625],
152             [0, 0.625, 2.5, 5.625, 10],
153         ],
154         colorscale="Electric",
155     )
156 )
157 st.plotly_chart(fig_contour, theme="streamlit")
158 
159 # Discrete Customization Chart
160 df = px.data.wind()
161 fig = px.scatter_polar(
162     df,
163     r="frequency",
164     theta="direction",
165     color="strength",
166     symbol="strength",
167     size="frequency",
168     color_discrete_sequence=px.colors.sequential.Plasma_r,
169 )
170 st.plotly_chart(fig, theme="streamlit")
171 
172 # Layout Customization Chart
173 import plotly.graph_objects as go
174 
175 fig = go.Figure(
176     go.Sunburst(
177         labels=[
178             "Eve",
179             "Cain",
180             "Seth",
181             "Enos",
182             "Noam",
183             "Abel",
184             "Awan",
185             "Enoch",
186             "Azura",
187         ],
188         parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"],
189         values=[65, 14, 12, 10, 2, 6, 6, 4, 4],
190         branchvalues="total",
191     )
192 )
193 fig.update_layout(margin=dict(t=10, l=100, r=100, b=110))
194 st.plotly_chart(fig, theme="streamlit")
195 
196 # Separate template Customization Chart
197 df = px.data.gapminder().query("country == 'Canada'")
198 fig = px.bar(
199     df,
200     x="year",
201     y="pop",
202     hover_data=["lifeExp", "gdpPercap"],
203     color="lifeExp",
204     template="plotly",
205     labels={"pop": "population of Canada"},
206     height=400,
207 )
208 
209 st.plotly_chart(fig, theme="streamlit")
210 
211 # Histogram chart
212 df = px.data.tips()
213 
214 fig = px.density_heatmap(df, x="total_bill", y="tip")
215 st.plotly_chart(fig, theme="streamlit")
216
```
--- 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()

```

diff --git a/e2e/scripts/st_plotly_chart.py b/e2e/scripts/st_plotly_chart.py
--- a/e2e/scripts/st_plotly_chart.py
+++ b/e2e/scripts/st_plotly_chart.py
@@ -15,8 +15,8 @@
 from datetime import datetime
 
 import numpy as np
+import pandas as pd
 import plotly.express as px
-import plotly.figure_factory as ff
 import plotly.graph_objects as go
 from plotly.subplots import make_subplots
 
@@ -42,7 +42,9 @@
 
 # Bubble Chart
 # Tests Discrete coloring with streamlit theme
-st.plotly_chart(fig_bubble, theme="streamlit")
+# uses container width when use_container_width flag is True
+fig_bubble.update_layout(height=300, width=300)
+st.plotly_chart(fig_bubble, use_container_width=True, theme="streamlit")
 
 # Candlestick Chart
 open_data_candlestick = [33.0, 33.3, 33.5, 33.0, 34.1]
@@ -121,8 +123,11 @@
     )
 )
 
-fig_waterfall.update_layout(title="Profit and loss statement 2018", showlegend=True)
-st.plotly_chart(fig_waterfall, theme="streamlit")
+fig_waterfall.update_layout(
+    title="Profit and loss statement 2018", height=300, width=300, showlegend=True
+)
+# uses figure height and width when use_container_width is False
+st.plotly_chart(fig_waterfall, use_container_width=False, theme="streamlit")
 
 # Ternary Chart
 df = px.data.election()
@@ -170,8 +175,6 @@
 st.plotly_chart(fig, theme="streamlit")
 
 # Layout Customization Chart
-import plotly.graph_objects as go
-
 fig = go.Figure(
     go.Sunburst(
         labels=[
@@ -213,3 +216,19 @@
 
 fig = px.density_heatmap(df, x="total_bill", y="tip")
 st.plotly_chart(fig, theme="streamlit")
+
+data = pd.DataFrame((100, 120, 104, 102, 203, 102), columns=["some_col"])
+
+fig = px.line(data, height=100, width=300)
+fig.update_xaxes(visible=False, fixedrange=True)
+fig.update_yaxes(visible=False, fixedrange=True)
+fig.update_layout(annotations=[], overwrite=True)
+fig.update_layout(showlegend=False, margin=dict(t=10, l=10, b=10, r=10))
+
+# uses figure height and width when use_container_width is False
+st.plotly_chart(
+    fig, config=dict(displayModeBar=False), use_container_width=False, theme=None
+)
+
+# uses container width when use_container_width flag is True
+st.plotly_chart(fig, use_container_width=True, theme=None)

{"golden_diff": "diff --git a/e2e/scripts/st_plotly_chart.py b/e2e/scripts/st_plotly_chart.py\n--- a/e2e/scripts/st_plotly_chart.py\n+++ b/e2e/scripts/st_plotly_chart.py\n@@ -15,8 +15,8 @@\n from datetime import datetime\n \n import numpy as np\n+import pandas as pd\n import plotly.express as px\n-import plotly.figure_factory as ff\n import plotly.graph_objects as go\n from plotly.subplots import make_subplots\n \n@@ -42,7 +42,9 @@\n \n # Bubble Chart\n # Tests Discrete coloring with streamlit theme\n-st.plotly_chart(fig_bubble, theme=\"streamlit\")\n+# uses container width when use_container_width flag is True\n+fig_bubble.update_layout(height=300, width=300)\n+st.plotly_chart(fig_bubble, use_container_width=True, theme=\"streamlit\")\n \n # Candlestick Chart\n open_data_candlestick = [33.0, 33.3, 33.5, 33.0, 34.1]\n@@ -121,8 +123,11 @@\n     )\n )\n \n-fig_waterfall.update_layout(title=\"Profit and loss statement 2018\", showlegend=True)\n-st.plotly_chart(fig_waterfall, theme=\"streamlit\")\n+fig_waterfall.update_layout(\n+    title=\"Profit and loss statement 2018\", height=300, width=300, showlegend=True\n+)\n+# uses figure height and width when use_container_width is False\n+st.plotly_chart(fig_waterfall, use_container_width=False, theme=\"streamlit\")\n \n # Ternary Chart\n df = px.data.election()\n@@ -170,8 +175,6 @@\n st.plotly_chart(fig, theme=\"streamlit\")\n \n # Layout Customization Chart\n-import plotly.graph_objects as go\n-\n fig = go.Figure(\n     go.Sunburst(\n         labels=[\n@@ -213,3 +216,19 @@\n \n fig = px.density_heatmap(df, x=\"total_bill\", y=\"tip\")\n st.plotly_chart(fig, theme=\"streamlit\")\n+\n+data = pd.DataFrame((100, 120, 104, 102, 203, 102), columns=[\"some_col\"])\n+\n+fig = px.line(data, height=100, width=300)\n+fig.update_xaxes(visible=False, fixedrange=True)\n+fig.update_yaxes(visible=False, fixedrange=True)\n+fig.update_layout(annotations=[], overwrite=True)\n+fig.update_layout(showlegend=False, margin=dict(t=10, l=10, b=10, r=10))\n+\n+# uses figure height and width when use_container_width is False\n+st.plotly_chart(\n+    fig, config=dict(displayModeBar=False), use_container_width=False, theme=None\n+)\n+\n+# uses container width when use_container_width flag is True\n+st.plotly_chart(fig, use_container_width=True, theme=None)\n", "issue": "Plotly charts ignore HEIGHT attribute after bug fix #5645\n### Checklist\r\n\r\n- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.\r\n- [X] I added a very descriptive title to this issue.\r\n- [X] I have provided sufficient information below to help reproduce this issue.\r\n\r\n### Summary\r\n\r\nWhen defining a chart with Plotly Express, you can provide a HEIGHT attribute defining.\r\nBefore bugfix #5645 this worked, but after this bugfix now the HEIGHT is ignored.\r\n\r\n\r\n### Reproducible Code Example\r\n\r\n[![Open in Streamlit Cloud](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://issues.streamlitapp.com/?issue=gh-5749)\r\n\r\n```Python\r\nimport streamlit as st\r\nimport pandas as pd\r\nimport plotly.express as px\r\n\r\ndata = pd.DataFrame((100,120,104,102,203,102),columns=[\"some_col\"])\r\n\r\nfig = px.line(data, height=100, width=200)\r\nfig.update_xaxes(visible=False, fixedrange=True)\r\nfig.update_yaxes(visible=False, fixedrange=True)\r\nfig.update_layout(annotations=[], overwrite=True)\r\nfig.update_layout(\r\n  showlegend=False,\r\n  plot_bgcolor=\"white\",\r\n  margin=dict(t=10,l=10,b=10,r=10)\r\n  )\r\nst.plotly_chart(fig,config=dict(displayModeBar=False))\r\n```\r\n\r\n\r\n### Steps To Reproduce\r\n\r\n_No response_\r\n\r\n### Expected Behavior\r\n\r\n_No response_\r\n\r\n### Current Behavior\r\n\r\n_No response_\r\n\r\n### Is this a regression?\r\n\r\n- [X] Yes, this used to work in a previous version.\r\n\r\n### Debug info\r\n\r\n- Streamlit version: 1.15.\r\n- Python version: 3.10\r\n- Operating System: Win 10\r\n- Browser: Edge\r\n- Virtual environment:\r\n\r\n\r\n### Additional Information\r\n\r\n_No response_\r\n\r\n### Are you willing to submit a PR?\r\n\r\n- [ ] Yes, I am willing to submit a PR!\n", "before_files": [{"content": "# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)\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\nfrom datetime import datetime\n\nimport numpy as np\nimport plotly.express as px\nimport plotly.figure_factory as ff\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\n\nimport streamlit as st\n\n# Explicitly seed the RNG for deterministic results\nnp.random.seed(0)\n\ndf_bubble = px.data.gapminder()\nfig_bubble = px.scatter(\n    df_bubble.query(\"year==2007\"),\n    x=\"gdpPercap\",\n    y=\"lifeExp\",\n    size=\"pop\",\n    color=\"continent\",\n    hover_name=\"country\",\n    log_x=True,\n    size_max=60,\n)\n\n# tests no streamlit theme plot\nst.plotly_chart(fig_bubble, theme=None)\n\n# Bubble Chart\n# Tests Discrete coloring with streamlit theme\nst.plotly_chart(fig_bubble, theme=\"streamlit\")\n\n# Candlestick Chart\nopen_data_candlestick = [33.0, 33.3, 33.5, 33.0, 34.1]\nhigh_data_candlestick = [33.1, 33.3, 33.6, 33.2, 34.8]\nlow_data_candlestick = [32.7, 32.7, 32.8, 32.6, 32.8]\nclose_data_candlestick = [33.0, 32.9, 33.3, 33.1, 33.1]\ndates_candlestick = [\n    datetime(year=2013, month=10, day=10),\n    datetime(year=2013, month=11, day=10),\n    datetime(year=2013, month=12, day=10),\n    datetime(year=2014, month=1, day=10),\n    datetime(year=2014, month=2, day=10),\n]\nfig_candlestick = go.Figure(\n    data=[\n        go.Candlestick(\n            x=dates_candlestick,\n            open=open_data_candlestick,\n            high=high_data_candlestick,\n            low=low_data_candlestick,\n            close=close_data_candlestick,\n        )\n    ]\n)\nst.plotly_chart(fig_candlestick, theme=\"streamlit\")\n\n# Tests sunburst charts and color parameter using streamlit colors\ndf = px.data.tips()\nfig_sunburst = px.sunburst(\n    df, path=[\"sex\", \"day\", \"time\"], values=\"total_bill\", color=\"day\"\n)\nst.plotly_chart(fig_sunburst, theme=\"streamlit\")\n\n# Contour Plot and Heatmap\nfig = make_subplots(\n    rows=2, cols=2, subplot_titles=(\"connectgaps = False\", \"connectgaps = True\")\n)\nz = [\n    [None, None, None, 12, 13, 14, 15, 16],\n    [None, 1, None, 11, None, None, None, 17],\n    [None, 2, 6, 7, None, None, None, 18],\n    [None, 3, None, 8, None, None, None, 19],\n    [5, 4, 10, 9, None, None, None, 20],\n    [None, None, None, 27, None, None, None, 21],\n    [None, None, None, 26, 25, 24, 23, 22],\n]\n\nfig.add_trace(go.Contour(z=z, showscale=False), 1, 1)\nfig.add_trace(go.Contour(z=z, showscale=False, connectgaps=True), 1, 2)\nfig.add_trace(go.Heatmap(z=z, showscale=False, zsmooth=\"best\"), 2, 1)\nfig.add_trace(go.Heatmap(z=z, showscale=False, connectgaps=True, zsmooth=\"best\"), 2, 2)\n\nfig[\"layout\"][\"yaxis1\"].update(title=\"Contour map\")\nfig[\"layout\"][\"yaxis3\"].update(title=\"Heatmap\")\n\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Waterfall Chart\nfig_waterfall = go.Figure(\n    go.Waterfall(\n        name=\"20\",\n        orientation=\"v\",\n        measure=[\"relative\", \"relative\", \"total\", \"relative\", \"relative\", \"total\"],\n        x=[\n            \"Sales\",\n            \"Consulting\",\n            \"Net revenue\",\n            \"Purchases\",\n            \"Other expenses\",\n            \"Profit before tax\",\n        ],\n        textposition=\"outside\",\n        text=[\"+60\", \"+80\", \"\", \"-40\", \"-20\", \"Total\"],\n        y=[60, 80, 0, -40, -20, 0],\n        connector={\"line\": {\"color\": \"rgb(63, 63, 63)\"}},\n    )\n)\n\nfig_waterfall.update_layout(title=\"Profit and loss statement 2018\", showlegend=True)\nst.plotly_chart(fig_waterfall, theme=\"streamlit\")\n\n# Ternary Chart\ndf = px.data.election()\nfig_ternary = px.scatter_ternary(df, a=\"Joly\", b=\"Coderre\", c=\"Bergeron\")\n\nst.plotly_chart(fig_ternary, theme=\"streamlit\")\n\n# Table Plot\nfig_table = go.Figure(\n    data=[\n        go.Table(\n            header=dict(values=[\"A Scores\", \"B Scores\"]),\n            cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]),\n        )\n    ]\n)\nst.plotly_chart(fig_table, theme=\"streamlit\")\n\n# Continuous Customization Chart with plotly.go graph\nfig_contour = go.Figure(\n    data=go.Contour(\n        z=[\n            [10, 10.625, 12.5, 15.625, 20],\n            [5.625, 6.25, 8.125, 11.25, 15.625],\n            [2.5, 3.125, 5.0, 8.125, 12.5],\n            [0.625, 1.25, 3.125, 6.25, 10.625],\n            [0, 0.625, 2.5, 5.625, 10],\n        ],\n        colorscale=\"Electric\",\n    )\n)\nst.plotly_chart(fig_contour, theme=\"streamlit\")\n\n# Discrete Customization Chart\ndf = px.data.wind()\nfig = px.scatter_polar(\n    df,\n    r=\"frequency\",\n    theta=\"direction\",\n    color=\"strength\",\n    symbol=\"strength\",\n    size=\"frequency\",\n    color_discrete_sequence=px.colors.sequential.Plasma_r,\n)\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Layout Customization Chart\nimport plotly.graph_objects as go\n\nfig = go.Figure(\n    go.Sunburst(\n        labels=[\n            \"Eve\",\n            \"Cain\",\n            \"Seth\",\n            \"Enos\",\n            \"Noam\",\n            \"Abel\",\n            \"Awan\",\n            \"Enoch\",\n            \"Azura\",\n        ],\n        parents=[\"\", \"Eve\", \"Eve\", \"Seth\", \"Seth\", \"Eve\", \"Eve\", \"Awan\", \"Eve\"],\n        values=[65, 14, 12, 10, 2, 6, 6, 4, 4],\n        branchvalues=\"total\",\n    )\n)\nfig.update_layout(margin=dict(t=10, l=100, r=100, b=110))\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Separate template Customization Chart\ndf = px.data.gapminder().query(\"country == 'Canada'\")\nfig = px.bar(\n    df,\n    x=\"year\",\n    y=\"pop\",\n    hover_data=[\"lifeExp\", \"gdpPercap\"],\n    color=\"lifeExp\",\n    template=\"plotly\",\n    labels={\"pop\": \"population of Canada\"},\n    height=400,\n)\n\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Histogram chart\ndf = px.data.tips()\n\nfig = px.density_heatmap(df, x=\"total_bill\", y=\"tip\")\nst.plotly_chart(fig, theme=\"streamlit\")\n", "path": "e2e/scripts/st_plotly_chart.py"}], "after_files": [{"content": "# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)\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\nfrom datetime import datetime\n\nimport numpy as np\nimport pandas as pd\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\n\nimport streamlit as st\n\n# Explicitly seed the RNG for deterministic results\nnp.random.seed(0)\n\ndf_bubble = px.data.gapminder()\nfig_bubble = px.scatter(\n    df_bubble.query(\"year==2007\"),\n    x=\"gdpPercap\",\n    y=\"lifeExp\",\n    size=\"pop\",\n    color=\"continent\",\n    hover_name=\"country\",\n    log_x=True,\n    size_max=60,\n)\n\n# tests no streamlit theme plot\nst.plotly_chart(fig_bubble, theme=None)\n\n# Bubble Chart\n# Tests Discrete coloring with streamlit theme\n# uses container width when use_container_width flag is True\nfig_bubble.update_layout(height=300, width=300)\nst.plotly_chart(fig_bubble, use_container_width=True, theme=\"streamlit\")\n\n# Candlestick Chart\nopen_data_candlestick = [33.0, 33.3, 33.5, 33.0, 34.1]\nhigh_data_candlestick = [33.1, 33.3, 33.6, 33.2, 34.8]\nlow_data_candlestick = [32.7, 32.7, 32.8, 32.6, 32.8]\nclose_data_candlestick = [33.0, 32.9, 33.3, 33.1, 33.1]\ndates_candlestick = [\n    datetime(year=2013, month=10, day=10),\n    datetime(year=2013, month=11, day=10),\n    datetime(year=2013, month=12, day=10),\n    datetime(year=2014, month=1, day=10),\n    datetime(year=2014, month=2, day=10),\n]\nfig_candlestick = go.Figure(\n    data=[\n        go.Candlestick(\n            x=dates_candlestick,\n            open=open_data_candlestick,\n            high=high_data_candlestick,\n            low=low_data_candlestick,\n            close=close_data_candlestick,\n        )\n    ]\n)\nst.plotly_chart(fig_candlestick, theme=\"streamlit\")\n\n# Tests sunburst charts and color parameter using streamlit colors\ndf = px.data.tips()\nfig_sunburst = px.sunburst(\n    df, path=[\"sex\", \"day\", \"time\"], values=\"total_bill\", color=\"day\"\n)\nst.plotly_chart(fig_sunburst, theme=\"streamlit\")\n\n# Contour Plot and Heatmap\nfig = make_subplots(\n    rows=2, cols=2, subplot_titles=(\"connectgaps = False\", \"connectgaps = True\")\n)\nz = [\n    [None, None, None, 12, 13, 14, 15, 16],\n    [None, 1, None, 11, None, None, None, 17],\n    [None, 2, 6, 7, None, None, None, 18],\n    [None, 3, None, 8, None, None, None, 19],\n    [5, 4, 10, 9, None, None, None, 20],\n    [None, None, None, 27, None, None, None, 21],\n    [None, None, None, 26, 25, 24, 23, 22],\n]\n\nfig.add_trace(go.Contour(z=z, showscale=False), 1, 1)\nfig.add_trace(go.Contour(z=z, showscale=False, connectgaps=True), 1, 2)\nfig.add_trace(go.Heatmap(z=z, showscale=False, zsmooth=\"best\"), 2, 1)\nfig.add_trace(go.Heatmap(z=z, showscale=False, connectgaps=True, zsmooth=\"best\"), 2, 2)\n\nfig[\"layout\"][\"yaxis1\"].update(title=\"Contour map\")\nfig[\"layout\"][\"yaxis3\"].update(title=\"Heatmap\")\n\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Waterfall Chart\nfig_waterfall = go.Figure(\n    go.Waterfall(\n        name=\"20\",\n        orientation=\"v\",\n        measure=[\"relative\", \"relative\", \"total\", \"relative\", \"relative\", \"total\"],\n        x=[\n            \"Sales\",\n            \"Consulting\",\n            \"Net revenue\",\n            \"Purchases\",\n            \"Other expenses\",\n            \"Profit before tax\",\n        ],\n        textposition=\"outside\",\n        text=[\"+60\", \"+80\", \"\", \"-40\", \"-20\", \"Total\"],\n        y=[60, 80, 0, -40, -20, 0],\n        connector={\"line\": {\"color\": \"rgb(63, 63, 63)\"}},\n    )\n)\n\nfig_waterfall.update_layout(\n    title=\"Profit and loss statement 2018\", height=300, width=300, showlegend=True\n)\n# uses figure height and width when use_container_width is False\nst.plotly_chart(fig_waterfall, use_container_width=False, theme=\"streamlit\")\n\n# Ternary Chart\ndf = px.data.election()\nfig_ternary = px.scatter_ternary(df, a=\"Joly\", b=\"Coderre\", c=\"Bergeron\")\n\nst.plotly_chart(fig_ternary, theme=\"streamlit\")\n\n# Table Plot\nfig_table = go.Figure(\n    data=[\n        go.Table(\n            header=dict(values=[\"A Scores\", \"B Scores\"]),\n            cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]),\n        )\n    ]\n)\nst.plotly_chart(fig_table, theme=\"streamlit\")\n\n# Continuous Customization Chart with plotly.go graph\nfig_contour = go.Figure(\n    data=go.Contour(\n        z=[\n            [10, 10.625, 12.5, 15.625, 20],\n            [5.625, 6.25, 8.125, 11.25, 15.625],\n            [2.5, 3.125, 5.0, 8.125, 12.5],\n            [0.625, 1.25, 3.125, 6.25, 10.625],\n            [0, 0.625, 2.5, 5.625, 10],\n        ],\n        colorscale=\"Electric\",\n    )\n)\nst.plotly_chart(fig_contour, theme=\"streamlit\")\n\n# Discrete Customization Chart\ndf = px.data.wind()\nfig = px.scatter_polar(\n    df,\n    r=\"frequency\",\n    theta=\"direction\",\n    color=\"strength\",\n    symbol=\"strength\",\n    size=\"frequency\",\n    color_discrete_sequence=px.colors.sequential.Plasma_r,\n)\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Layout Customization Chart\nfig = go.Figure(\n    go.Sunburst(\n        labels=[\n            \"Eve\",\n            \"Cain\",\n            \"Seth\",\n            \"Enos\",\n            \"Noam\",\n            \"Abel\",\n            \"Awan\",\n            \"Enoch\",\n            \"Azura\",\n        ],\n        parents=[\"\", \"Eve\", \"Eve\", \"Seth\", \"Seth\", \"Eve\", \"Eve\", \"Awan\", \"Eve\"],\n        values=[65, 14, 12, 10, 2, 6, 6, 4, 4],\n        branchvalues=\"total\",\n    )\n)\nfig.update_layout(margin=dict(t=10, l=100, r=100, b=110))\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Separate template Customization Chart\ndf = px.data.gapminder().query(\"country == 'Canada'\")\nfig = px.bar(\n    df,\n    x=\"year\",\n    y=\"pop\",\n    hover_data=[\"lifeExp\", \"gdpPercap\"],\n    color=\"lifeExp\",\n    template=\"plotly\",\n    labels={\"pop\": \"population of Canada\"},\n    height=400,\n)\n\nst.plotly_chart(fig, theme=\"streamlit\")\n\n# Histogram chart\ndf = px.data.tips()\n\nfig = px.density_heatmap(df, x=\"total_bill\", y=\"tip\")\nst.plotly_chart(fig, theme=\"streamlit\")\n\ndata = pd.DataFrame((100, 120, 104, 102, 203, 102), columns=[\"some_col\"])\n\nfig = px.line(data, height=100, width=300)\nfig.update_xaxes(visible=False, fixedrange=True)\nfig.update_yaxes(visible=False, fixedrange=True)\nfig.update_layout(annotations=[], overwrite=True)\nfig.update_layout(showlegend=False, margin=dict(t=10, l=10, b=10, r=10))\n\n# uses figure height and width when use_container_width is False\nst.plotly_chart(\n    fig, config=dict(displayModeBar=False), use_container_width=False, theme=None\n)\n\n# uses container width when use_container_width flag is True\nst.plotly_chart(fig, use_container_width=True, theme=None)\n", "path": "e2e/scripts/st_plotly_chart.py"}]}