瀏覽代碼

Fix missing m/d on trend component plot. Previously we used MaxNLocator to limit the number of tick marks on the trend and holiday component plots. This was putting the ticks at various points throughout the year, however the tick label showed only the year, which one would incorrectly assume to be Jan 1. This commit removes MaxNLocator and allows matplotlib to set xticks as it pleases, and updates the effected documentation.

Ben Letham 8 年之前
父節點
當前提交
2c8419e673

+ 17 - 17
docs/_docs/quick_start.md

@@ -148,36 +148,36 @@ forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
       <th>3265</th>
       <td>2017-01-15</td>
       <td>8.205065</td>
-      <td>7.518780</td>
-      <td>8.899184</td>
+      <td>7.488507</td>
+      <td>8.887731</td>
     </tr>
     <tr>
       <th>3266</th>
       <td>2017-01-16</td>
       <td>8.530088</td>
-      <td>7.752344</td>
-      <td>9.246332</td>
+      <td>7.862778</td>
+      <td>9.223688</td>
     </tr>
     <tr>
       <th>3267</th>
       <td>2017-01-17</td>
       <td>8.317468</td>
-      <td>7.641099</td>
-      <td>9.039998</td>
+      <td>7.644606</td>
+      <td>9.021893</td>
     </tr>
     <tr>
       <th>3268</th>
       <td>2017-01-18</td>
       <td>8.150081</td>
-      <td>7.333512</td>
-      <td>8.888837</td>
+      <td>7.462394</td>
+      <td>8.889095</td>
     </tr>
     <tr>
       <th>3269</th>
       <td>2017-01-19</td>
       <td>8.162015</td>
-      <td>7.415570</td>
-      <td>8.850360</td>
+      <td>7.438503</td>
+      <td>8.877361</td>
     </tr>
   </tbody>
 </table>
@@ -236,12 +236,12 @@ tail(future)
 ```
 
                  ds
-    3264 2017-01-13
     3265 2017-01-14
     3266 2017-01-15
     3267 2017-01-16
     3268 2017-01-17
     3269 2017-01-18
+    3270 2017-01-19
 
 
 
@@ -254,12 +254,12 @@ tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
 ```
 
                  ds     yhat yhat_lower yhat_upper
-    3264 2017-01-13 8.052054   7.328934   8.845277
-    3265 2017-01-14 7.832396   7.147092   8.515437
-    3266 2017-01-15 8.214232   7.439343   8.947970
-    3267 2017-01-16 8.539239   7.804152   9.243396
-    3268 2017-01-17 8.326654   7.635376   9.036896
-    3269 2017-01-18 8.159337   7.445167   8.907354
+    3265 2017-01-14 7.832396   7.140713   8.533132
+    3266 2017-01-15 8.214232   7.460897   8.918678
+    3267 2017-01-16 8.539239   7.788240   9.262142
+    3268 2017-01-17 8.326654   7.615613   9.003147
+    3269 2017-01-18 8.159337   7.382162   8.889958
+    3270 2017-01-19 8.171276   7.354854   8.922918
 
 
 

二進制
docs/static/quick_start_files/quick_start_12_0.png


二進制
docs/static/quick_start_files/quick_start_14_0.png


二進制
docs/static/quick_start_files/quick_start_26_0.png


二進制
docs/static/quick_start_files/quick_start_28_0.png


文件差異過大導致無法顯示
+ 30 - 30
notebooks/quick_start.ipynb


+ 0 - 3
python/fbprophet/forecaster.py

@@ -16,7 +16,6 @@ import pickle
 
 from matplotlib import pyplot as plt
 from matplotlib.dates import DateFormatter, MonthLocator
-from matplotlib.ticker import MaxNLocator
 
 import numpy as np
 import pandas as pd
@@ -712,7 +711,6 @@ class Prophet(object):
                 fcst['ds'].values, fcst['trend_lower'], fcst['trend_upper'],
                 color='#0072B2', alpha=0.2)]
         ax.grid(True, which='major', c='gray', ls='-', lw=1, alpha=0.2)
-        ax.xaxis.set_major_locator(MaxNLocator(nbins=7))
         ax.set_xlabel('ds')
         ax.set_ylabel('trend')
         return artists
@@ -749,7 +747,6 @@ class Prophet(object):
                                         y_holiday_l, y_holiday_u,
                                         color='#0072B2', alpha=0.2)]
         ax.grid(True, which='major', c='gray', ls='-', lw=1, alpha=0.2)
-        ax.xaxis.set_major_locator(MaxNLocator(nbins=7))
         ax.set_xlabel('ds')
         ax.set_ylabel('holidays')
         return artists