| import pandas as pd
|
| import streamlit as st
|
| import plotly.express as px
|
| from matplotlib import pyplot as plt
|
| from urllib.error import URLError
|
| from utils.code_utils import show_code
|
|
|
|
|
| def visualize():
|
|
|
| df = pd.read_csv("dataset/iris.csv")
|
|
|
| contact_options = ["Sepal", "Petal", "Length", "Width"]
|
| contact_selected = st.selectbox("Select a Iris value", contact_options)
|
|
|
| if contact_selected == "Sepal":
|
| inform = f"Iris {contact_selected} Plot:"
|
| fig = px.scatter(df, x="sepal.length", y="sepal.width", title=inform, color="variety")
|
| st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
| elif contact_selected == "Petal":
|
| inform = f"Iris {contact_selected} Plot:"
|
| fig = px.scatter(df, x="petal.length", y="petal.width", title=inform, color="variety")
|
| st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
| elif contact_selected == "Length":
|
| inform = f"Iris {contact_selected} Plot:"
|
| fig = px.scatter(df, x="sepal.length", y="petal.length", title=inform, color="variety")
|
| st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
| elif contact_selected == "Width":
|
| inform = f"Iris {contact_selected} Plot:"
|
| fig = px.scatter(df, x="sepal.width", y="petal.width", title=inform, color="variety")
|
| st.plotly_chart(fig, use_container_width=True)
|
|
|
|
|
| visualize()
|
|
|
| show_code(visualize)
|
|
|
|
|
| |