LakshmiHarika commited on
Commit
1a2abba
·
verified ·
1 Parent(s): c80f2b3

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +17 -11
pages/Data Collection.py CHANGED
@@ -314,32 +314,38 @@ elif st.session_state.current_page == "explore_images_video":
314
  </p>
315
  </div>
316
  """, unsafe_allow_html=True)
 
 
317
  # Visualization for Grid-Like Structure
318
  st.markdown("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
319
- height, width = 1,1
320
  grid = np.random.rand(height, width)
321
- fig, ax = plt.subplots()
 
 
322
  cax = ax.imshow(grid, cmap='viridis')
323
-
324
  # Annotate the grid with pixel labels
325
  for i in range(height):
326
  for j in range(width):
327
- ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', color='white', fontsize=3)
328
-
329
  # Set axis labels and title
330
- ax.set_title("Image as a Grid-Like Structure", fontsize=5)
331
- ax.set_xlabel("Width (Pixels)", fontsize=4)
332
- ax.set_ylabel("Height (Pixels)", fontsize=4)
333
  ax.set_xticks(range(width))
334
  ax.set_yticks(range(height))
335
- ax.set_xticklabels([f'Col {j+1}' for j in range(width)])
336
- ax.set_yticklabels([f'Row {i+1}' for i in range(height)])
337
  ax.grid(color='white', linestyle='-', linewidth=1)
338
  fig.colorbar(cax, ax=ax, orientation='vertical', label='Pixel Value')
339
-
 
340
  st.pyplot(fig)
341
 
342
 
 
343
  # Go Back Button
344
  if st.button("Go Back"):
345
  navigate_to("main")
 
314
  </p>
315
  </div>
316
  """, unsafe_allow_html=True)
317
+ import streamlit as st
318
+
319
  # Visualization for Grid-Like Structure
320
  st.markdown("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
321
+ height, width = 6, 6
322
  grid = np.random.rand(height, width)
323
+
324
+ # Adjust the figure size to make the plot smaller
325
+ fig, ax = plt.subplots(figsize=(4, 4)) # Smaller figure size
326
  cax = ax.imshow(grid, cmap='viridis')
327
+
328
  # Annotate the grid with pixel labels
329
  for i in range(height):
330
  for j in range(width):
331
+ ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', color='white', fontsize=6) # Adjusted fontsize
332
+
333
  # Set axis labels and title
334
+ ax.set_title("Image as a Grid-Like Structure", fontsize=6) # Adjusted title size
335
+ ax.set_xlabel("Width (Pixels)", fontsize=6) # Adjusted label size
336
+ ax.set_ylabel("Height (Pixels)", fontsize=6) # Adjusted label size
337
  ax.set_xticks(range(width))
338
  ax.set_yticks(range(height))
339
+ ax.set_xticklabels([f'Col {j+1}' for j in range(width)], fontsize=5) # Adjusted label size
340
+ ax.set_yticklabels([f'Row {i+1}' for i in range(height)], fontsize=5) # Adjusted label size
341
  ax.grid(color='white', linestyle='-', linewidth=1)
342
  fig.colorbar(cax, ax=ax, orientation='vertical', label='Pixel Value')
343
+
344
+ # Display the plot
345
  st.pyplot(fig)
346
 
347
 
348
+
349
  # Go Back Button
350
  if st.button("Go Back"):
351
  navigate_to("main")