Skip to content

Commit

Permalink
update streamlit plotly usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jgieseler committed Aug 1, 2024
1 parent a89e2e5 commit 0901247
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions solarmach/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,10 @@ 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
# import streamlit.components.v1 as components
# st.plotly_chart(pfig, theme="streamlit")
components.html(pfig.to_html(include_mathjax='cdn'), height=500)
# components.html(pfig.to_html(include_mathjax='cdn'), height=500)
st.plotly_chart(fig, theme="streamlit", use_container_width=True)
else:
pfig.show()

Expand Down Expand Up @@ -1853,11 +1854,11 @@ def pfss_3d(self, active_area=(None, None, None, None), color_code='object', rss
colorscale='gray', showscale=False, opacity=0.2))

if _isstreamlit():
fig.update_layout(width=700, height=700)
# fig.update_layout(width=700, height=700)
import streamlit as st
import streamlit.components.v1 as components
# st.plotly_chart(pfig, theme="streamlit")
components.html(fig.to_html(include_mathjax='cdn'), height=700)
# import streamlit.components.v1 as components
# components.html(fig.to_html(include_mathjax='cdn'), height=700)
st.plotly_chart(fig, theme="streamlit", use_container_width=True)
else:
fig.show()

Expand Down Expand Up @@ -2035,11 +2036,11 @@ def plot_3d(self,
colorscale='gray', showscale=False, opacity=0.2))

if _isstreamlit():
fig.update_layout(width=700, height=700)
# fig.update_layout(width=700, height=700)
import streamlit as st
import streamlit.components.v1 as components
# st.plotly_chart(pfig, theme="streamlit")
components.html(fig.to_html(include_mathjax='cdn'), height=700)
# import streamlit.components.v1 as components
# components.html(fig.to_html(include_mathjax='cdn'), height=700)
st.plotly_chart(fig, theme="streamlit", use_container_width=True)
else:
fig.show()

Expand Down

0 comments on commit 0901247

Please sign in to comment.