【发布时间】:2021-09-09 20:12:41
【问题描述】:
谁能帮我把它做成一个循环或者它可以是一个循环?我只是想检查它是否可以循环。我是 python 和 streamlit 库的新手,呵呵。我也想在这里学习以提高自己的水平。谢谢你!
c1,c2,c3,c4,c5,c6,c7 = st.beta_columns(7)
with c1:
fig1 = plt.figure(figsize=(14,8))
fig1.suptitle("Gray Eqhist")
plt.imshow(gray_eqhist, 'gray')
st.pyplot(fig1)
with c2:
fig2 = plt.figure(figsize=(14,8))
fig2.suptitle("Applied Clahe")
plt.imshow(applied_clahe, 'gray')
st.pyplot(fig2)
with c3:
fig3 = plt.figure(figsize=(14,8))
fig3.suptitle("Binary")
plt.imshow(thresh1, 'gray')
st.pyplot(fig3)
with c4:
fig4 = plt.figure(figsize=(14,8))
fig4.suptitle("Binary Threshold Inverted")
plt.imshow(thresh2, 'gray')
st.pyplot(fig4)
with c5:
fig5 = plt.figure(figsize=(14,8))
fig5.suptitle("Truncated Threshold")
plt.imshow(thresh3, 'gray')
st.pyplot(fig5)
with c6:
fig6 = plt.figure(figsize=(14,8))
fig6.suptitle("Set to 0")
plt.imshow(thresh4, 'gray')
st.pyplot(fig6)
with c7:
fig7 = plt.figure(figsize=(14,8))
fig7.suptitle("Set to 0 Inverted")
plt.imshow(thresh5, 'gray')
st.pyplot(fig7)
【问题讨论】:
-
您可以遍历其他变量,例如您的图表和标签,并执行以下表格示例:
for i in range(1, 10): cols = st.beta_columns(4) cols[0].write(f'{i}') cols[1].write(f'{i * i}') cols[2].write(f'{i * i * i}') cols[3].write('x' * i)