ce-dric commited on
Commit
9e8586d
·
1 Parent(s): 776951a

fixed legend showing

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -22,8 +22,8 @@ if len(uploaded_files) == 3:
22
  scan_lines.append(scan_line)
23
 
24
  plt.figure(figsize=(10, 6))
25
- line_styles = ['-', '--', '-.']
26
- colors = ['b', 'g', 'r']
27
 
28
  for i, scan_line in enumerate(scan_lines):
29
  file_name = uploaded_files[i].name
@@ -35,6 +35,9 @@ if len(uploaded_files) == 3:
35
  plt.xlabel('Pixel Position')
36
  plt.ylabel('Pixel Value')
37
  plt.title('Comparison of Scan Lines Across Images')
38
- plt.legend(loc='upper left')
 
 
 
39
  st.pyplot(plt)
40
 
 
22
  scan_lines.append(scan_line)
23
 
24
  plt.figure(figsize=(10, 6))
25
+ line_styles = ['-.', '--', 'solid']
26
+ colors = ['blue', 'green', 'red']
27
 
28
  for i, scan_line in enumerate(scan_lines):
29
  file_name = uploaded_files[i].name
 
35
  plt.xlabel('Pixel Position')
36
  plt.ylabel('Pixel Value')
37
  plt.title('Comparison of Scan Lines Across Images')
38
+
39
+ handles, labels = plt.gca().get_legend_handles_labels()
40
+ by_label = dict(zip(labels, handles))
41
+ plt.legend(by_label.values(), by_label.keys(), loc='upper left')
42
  st.pyplot(plt)
43