about summary refs log tree commit diff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/corr_scatter_plot.py12
-rw-r--r--wqflask/wqflask/templates/corr_scatterplot.html13
2 files changed, 22 insertions, 3 deletions
diff --git a/wqflask/wqflask/correlation/corr_scatter_plot.py b/wqflask/wqflask/correlation/corr_scatter_plot.py
index 07aa947e..e7fe8b91 100644
--- a/wqflask/wqflask/correlation/corr_scatter_plot.py
+++ b/wqflask/wqflask/correlation/corr_scatter_plot.py
@@ -38,6 +38,11 @@ class CorrScatterPlot(object):
         self.data.append(vals_2)
 
         slope, intercept, r_value, p_value, std_err = stats.linregress(vals_1, vals_2)
+
+        if slope < 0.001:
+            slope_string = '%.3E' % slope
+        else:
+            slope_string = str(slope)
         
         x_buffer = (max(vals_1) - min(vals_1))*0.1
         y_buffer = (max(vals_2) - min(vals_2))*0.1
@@ -54,6 +59,11 @@ class CorrScatterPlot(object):
         self.rdata.append(ry.tolist())        
         srslope, srintercept, srr_value, srp_value, srstd_err = stats.linregress(rx, ry)
 
+        if srslope < 0.001:
+            srslope_string = '%.3E' % srslope
+        else:
+            srslope_string = str(srslope)
+
         x_buffer = (max(rx) - min(rx))*0.1
         y_buffer = (max(ry) - min(ry))*0.1
 
@@ -90,11 +100,13 @@ class CorrScatterPlot(object):
             sr_intercept_coords = sr_intercept_coords,
 
             slope = slope,
+            slope_string = slope_string,
             intercept = intercept,
             r_value = r_value,
             p_value = p_value,
 
             srslope = srslope,
+            srslope_string = srslope_string,
             srintercept = srintercept,
             srr_value = srr_value,
             srp_value = srp_value
diff --git a/wqflask/wqflask/templates/corr_scatterplot.html b/wqflask/wqflask/templates/corr_scatterplot.html
index 545c0b94..a8d65169 100644
--- a/wqflask/wqflask/templates/corr_scatterplot.html
+++ b/wqflask/wqflask/templates/corr_scatterplot.html
@@ -145,7 +145,7 @@
           </tr>
           <tr>
             <td>Slope</td>
-            <td>{{'%0.3f' % jsdata.slope}}</td>
+            <td>{{ jsdata.slope_string }}</td>
           </tr>
           <tr>
             <td>Intercept</td>
@@ -163,7 +163,7 @@
             <td style="text-align: left;" colspan="2">
               Regression Line
               <br>
-              y = {{'%0.3f' % jsdata.slope}} * x + {{'%0.3f' % jsdata.intercept}}
+              y = {{ jsdata.slope_string }} * x + {{'%0.3f' % jsdata.intercept}}
             </td>
           </tr>
         </tbody>
@@ -260,7 +260,7 @@
             </tr>
             <tr>
               <td>Slope</td>
-              <td>{{'%0.3f' % jsdata.srslope}}</td>
+              <td>{{ jsdata.srslope_string }}</td>
             </tr>
             <tr>
               <td>Intercept</td>
@@ -274,6 +274,13 @@
               <td>P value</td>
               <td>{% if jsdata.srp_value < 0.001 %}{{'%0.3e' % jsdata.srp_value}}{% else %}{{'%0.3f' % jsdata.srp_value}}{% endif %}</td>
             </tr>
+            <tr>
+              <td style="text-align: left;" colspan="2">
+                Regression Line
+                <br>
+                y = {{ jsdata.srslope_string }} * x + {{'%0.3f' % jsdata.srintercept}}
+              </td>
+            </tr>
           </tbody>
         </table>
       </div>