Updated Large Data user guide with datetime support
"You can thus very naturally explore even very large multidimensional datasets. Note that the static exported version (e.g. on anaconda.org) will only show a single frame, rather than the entire set of frames visible with a live Python server.\n",
"\n",
"\n",
- "## Working with time series\n",
- "\n",
- "Although Datashader does not natively [support datetime(64)](https://github.com/bokeh/datashader/issues/270) types for its dimensions, we can convert to an integer representation and apply a custom formatter using HoloViews and Bokeh:"
+ "## Working with time series"
]
},
{
- "cell_type": "code",
- "execution_count": null,
+ "cell_type": "markdown",
"metadata": {},
- "outputs": [],
"source": [
- "from bokeh.models import DatetimeTickFormatter\n",
- "def apply_formatter(plot, element):\n",
- " plot.handles['xaxis'].formatter = DatetimeTickFormatter()\n",
- " \n",
- "import pandas as pd\n",
- "drange = pd.date_range(start=\"2014-01-01\", end=\"2016-01-01\", freq='1D') # or '1min'\n",
- "dates = drange.values.astype('int64')/10**6 # Convert dates to ints"
+ "HoloViews also makes it possible to datashade large timeseries using the ``datashade`` and ``aggregate`` operations."
]
},
{
"metadata": {},
"outputs": [],
"source": [
- "%%opts RGB [finalize_hooks=[apply_formatter] width=800]\n",
- "\n",
+ "%%opts RGB [width=800]\n",
+ "import pandas as pd\n",
+ "dates = pd.date_range(start=\"2014-01-01\", end=\"2016-01-01\", freq='1D') # or '1min'\n",
"curve = hv.Curve((dates, time_series(N=len(dates), sigma = 1)))\n",
"datashade(curve, cmap=[\"blue\"])"
]
"metadata": {},
"outputs": [],
"source": [
- "%%opts Overlay [finalize_hooks=[apply_formatter] width=800] \n",
+ "%%opts Overlay [width=800] \n",
"%%opts Scatter [tools=['hover', 'box_select']] (line_color=\"black\" fill_color=\"red\" size=10)\n",
"from holoviews.operation.timeseries import rolling, rolling_outlier_std\n",
"smoothed = rolling(curve, rolling_window=50)\n",
"datashade(curve, cmap=[\"blue\"]) * dynspread(datashade(smoothed, cmap=[\"red\"]),max_px=1) * outliers"
]
},
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "rolling.function"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
