eaglelandsonce commited on
Commit
1dd6aad
·
verified ·
1 Parent(s): 7299eb3

Create 22_SimpleNoise.py

Browse files
Files changed (1) hide show
  1. pages/22_SimpleNoise.py +25 -0
pages/22_SimpleNoise.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import matplotlib.pyplot as plt
4
+
5
+ # Streamlit app title
6
+ st.title('Interactive Scatter Plot with Noise and Number of Data Points')
7
+
8
+ # Sidebar sliders for noise and number of data points
9
+ noise_level = st.sidebar.slider('Noise Level', 0.0, 1.0, 0.1, step=0.01)
10
+ num_points = st.sidebar.slider('Number of Data Points', 100, 1000, 500, step=50)
11
+
12
+ # Generate data
13
+ np.random.seed(0)
14
+ x = np.linspace(0, 10, num_points)
15
+ y = np.sin(x) + noise_level * np.random.randn(num_points)
16
+
17
+ # Create scatter plot
18
+ fig, ax = plt.subplots()
19
+ ax.scatter(x, y, alpha=0.6)
20
+ ax.set_title('Scatter Plot with Noise and Number of Data Points')
21
+ ax.set_xlabel('X-axis')
22
+ ax.set_ylabel('Y-axis')
23
+
24
+ # Display plot in Streamlit
25
+ st.pyplot(fig)