Skip to content

Commit

Permalink
update streamlit.components.v1 import for plotly
Browse files Browse the repository at this point in the history
  • Loading branch information
jgieseler committed May 21, 2024
1 parent dbe0662 commit daf4988
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions solarmach/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,9 @@ def plot(self, plot_spirals=True,
# if using streamlit, send plot to streamlit output, else call plt.show()
if _isstreamlit():
import streamlit as st
import streamlit.components.v1 as components
# st.plotly_chart(pfig, theme="streamlit")
st.components.v1.html(pfig.to_html(include_mathjax='cdn'), height=500)
components.html(pfig.to_html(include_mathjax='cdn'), height=500)
else:
pfig.show()

Expand Down Expand Up @@ -1840,8 +1841,9 @@ def pfss_3d(self, active_area=(None, None, None, None), color_code='object', rss
if _isstreamlit():
fig.update_layout(width=700, height=700)
import streamlit as st
import streamlit.components.v1 as components
# st.plotly_chart(pfig, theme="streamlit")
st.components.v1.html(fig.to_html(include_mathjax='cdn'), height=700)
components.html(fig.to_html(include_mathjax='cdn'), height=700)
else:
fig.show()

Expand Down Expand Up @@ -2021,8 +2023,9 @@ def plot_3d(self,
if _isstreamlit():
fig.update_layout(width=700, height=700)
import streamlit as st
import streamlit.components.v1 as components
# st.plotly_chart(pfig, theme="streamlit")
st.components.v1.html(fig.to_html(include_mathjax='cdn'), height=700)
components.html(fig.to_html(include_mathjax='cdn'), height=700)
else:
fig.show()

Expand Down

0 comments on commit daf4988

Please sign in to comment.