[Streamlit] sidebar활용
2024. 1. 30. 09:52ㆍData Science/Study 자료
# _*_ coding:utf-8 _*_
import streamlit as st
import matplotlib.pyplot as plt
def main():
value1 = st.slider("숫자선택",0,100)
st.write(value1)
value2 = st.sidebar.slider("숫자",0,200)
st.sidebar.write(value2)
#st.write(value2)
with st.sidebar:
# 데코레이터 : 음식 서빙이 종료되면 처음부터 세팅
value3 = st.slider("숫자선택,with sidebar",0,300)
st.write(value3)
st.markdown("matplotlib")
fig, ax =plt.subplots()
ax.plot([1,2,3])
st.pyplot(fig)
fig, ax =plt.subplots()
ax.plot([1,2,4])
st.pyplot(fig)
if __name__ == "__main__":
main()
sidebar 명령어를 통해서 좌측 바에 자료들을 넣을 수 있다.
value2 = st.sidebar.slider("숫자",0,200)
st.sidebar.write(value2)
#st.write(value2)
with st.sidebar: 명령어를 통해 모아서 사용이 가능하다. matplotlib등의 그래프도 넣을 수 있다.
#사이드바 부분
with st.sidebar:
# 데코레이터 : 음식 서빙이 종료되면 처음부터 세팅
value3 = st.slider("숫자선택,with sidebar",0,300)
st.write(value3)
st.markdown("matplotlib")
fig, ax =plt.subplots()
ax.plot([1,2,3])
st.pyplot(fig)
# 원문 부분
fig, ax =plt.subplots()
ax.plot([1,2,4])
st.pyplot(fig)
'Data Science > Study 자료' 카테고리의 다른 글
Api Crawling /Json 형식 데이터 단일/다중 수집 서울 열린데이터 광장 (0) | 2024.02.01 |
---|---|
[Streamlit] tab과 col 명령어 (1) | 2024.01.30 |
[Streamlit] st.write/ 마크다운 사용하기 (0) | 2024.01.29 |
내가 보려고 만드는 기본 리눅스 명령어 정리 (0) | 2024.01.23 |
[통계] 통계 테스트용 문항 (0) | 2024.01.21 |