sentiment / pages /1_πŸ“ˆ_Sentiment_Plot.py
karar-shah's picture
Create pages/1_πŸ“ˆ_Sentiment_Plot.py
fe50ad7
raw
history blame contribute delete
995 Bytes
import streamlit as st
import time
import numpy as np
import plotly.graph_objects as go
st.set_page_config(page_title="Plotting Demo", page_icon="πŸ“ˆ")
st.markdown("<h1><center>Plotting Emotion Sentiments</center></h1>",
unsafe_allow_html=True)
# st.sidebar.header("---")
if 'color' not in st.session_state:
st.session_state.colors = [
'#FF595E', '#323e5d', '#8AC926', '#ff9494', '#6A4C93', '#2A2B2D', '#F6AE2D']
# Create a bar chart
fig = go.Figure(data=[go.Bar(
x=list(st.session_state.emotion_counts.keys()),
y=list(st.session_state.emotion_counts.values()),
marker=dict(
color=st.session_state.colors
)
)])
# Update layout for better visualization and set figure size
fig.update_layout(
title='Emotion Counts',
xaxis=dict(title='Emotion Categories'),
yaxis=dict(title='Count'),
width=800, # Set the width of the figure
height=500 # Set the height of the figure
)
st.plotly_chart(fig, use_container_width=True)