wenjun99 commited on
Commit
2b1df64
·
verified ·
1 Parent(s): 7ed5967

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +11 -2
src/app.py CHANGED
@@ -1123,8 +1123,17 @@ with tab3:
1123
  all_vals = melted["Value"].values
1124
  ax2.hist(all_vals, bins=n_bins, color="#808080", alpha=0.8, label="All")
1125
  ax2.set_xlim(left=0.0)
1126
- ax2.xaxis.set_major_locator(MultipleLocator(0.5))
1127
- ax2.xaxis.set_minor_locator(MultipleLocator(0.1))
 
 
 
 
 
 
 
 
 
1128
  ax2.tick_params(axis="x", which="major", length=6)
1129
  ax2.tick_params(axis="x", which="minor", length=3)
1130
  ax2.legend(fontsize=8)
 
1123
  all_vals = melted["Value"].values
1124
  ax2.hist(all_vals, bins=n_bins, color="#808080", alpha=0.8, label="All")
1125
  ax2.set_xlim(left=0.0)
1126
+ val_range = np.nanmax(all_vals) - np.nanmin(all_vals)
1127
+ if val_range <= 5:
1128
+ major_step, minor_step = 0.5, 0.1
1129
+ elif val_range <= 20:
1130
+ major_step, minor_step = 2, 0.5
1131
+ elif val_range <= 50:
1132
+ major_step, minor_step = 5, 1
1133
+ else:
1134
+ major_step, minor_step = 10, 2
1135
+ ax2.xaxis.set_major_locator(MultipleLocator(major_step))
1136
+ ax2.xaxis.set_minor_locator(MultipleLocator(minor_step))
1137
  ax2.tick_params(axis="x", which="major", length=6)
1138
  ax2.tick_params(axis="x", which="minor", length=3)
1139
  ax2.legend(fontsize=8)