File size: 1,421 Bytes
284798b
 
22230e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284798b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import streamlit as st  # Ensure Streamlit is imported first
import matplotlib.pyplot as plt

# Page configuration
st.set_page_config(page_title="PEC Generative AI Training Survey Results", layout="centered")

# Data for the survey
labels = ['Yes', 'No', 'No Answer Provided']
values = [85.60, 14.20, 0.21]
colors = ['#4CAF50', '#FF5722', '#9E9E9E']  # Colors for bars

# Create the bar chart
def create_bar_chart():
    plt.figure(figsize=(8, 6))
    plt.bar(labels, values, color=colors)
    
    # Adding a title and labels
    plt.title("PEC Generative AI Training Survey Results", fontsize=14)
    plt.xlabel("Responses", fontsize=12)
    plt.ylabel("Percentage", fontsize=12)
    
    # Setting the y-axis limit for clarity
    plt.ylim(0, 100)
    
    # Adding value labels above the bars
    for i, value in enumerate(values):
        plt.text(i, value + 1, f"{value}%", ha='center', fontsize=11)
    
    # Display grid lines for better readability
    plt.grid(axis='y', linestyle='--', alpha=0.7)
    
    # Tight layout for better spacing
    plt.tight_layout()
    
    # Return the chart as a Streamlit figure
    return plt

# Streamlit app interface
st.title("PEC Generative AI Training Survey Results")
st.write("This chart represents the responses to the question: **'Were you able to learn, practice, and build a complete application by yourself?'**")

# Display chart
st.pyplot(create_bar_chart())