-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from predict-idlab/improve_docs
📦 improve docs
- Loading branch information
Showing
33 changed files
with
2,901 additions
and
951 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
venv* | ||
.cache_datasets/ | ||
*.DS_Store | ||
file_system_store/ | ||
|
||
# Sphinx documentation | ||
*_build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
.. role:: raw-html(raw) | ||
:format: html | ||
|
||
.. |br| raw:: html | ||
|
||
<br> | ||
|
||
|
||
FAQ ❓ | ||
====== | ||
|
||
.. raw:: html | ||
|
||
<details> | ||
<summary> | ||
<a><b>What does the orange <b style="color:orange">~ time|number </b> suffix in legend name indicate?</b></a> | ||
</summary> | ||
<div style="margin-left:1em"> | ||
|
||
|
||
This tilde suffix is only shown when the data is aggregated and represents the *mean aggregation bin size* which is the mean index-range difference between two consecutive aggregated samples. | ||
|
||
* for *time-indexed data*: the mean time-range between 2 consecutive (sampled) samples. | ||
* for *numeric-indexed data*: the mean numeric range between 2 consecutive (sampled) samples. | ||
|
||
When the index is a range-index; the *mean aggregation bin size* represents the *mean* downsample ratio; i.e., the mean number of samples that are aggregated into one sample. | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
</details> | ||
<br> | ||
<details> | ||
<summary> | ||
<a><b>What is the difference between plotly-resampler figures and plain plotly figures?</b></a> | ||
</summary> | ||
<div style="margin-left:1em"> | ||
|
||
plotly-resampler can be thought of as wrapper around plain plotly figures which adds line-chart visualization scalability by dynamically aggregating the data of the figures w.r.t. the front-end view. plotly-resampler thus adds dynamic aggregation functionality to plain plotly figures. | ||
|
||
**important to know**: | ||
|
||
* ``show`` *always* returns a static html view of the figure, i.e., no dynamic aggregation can be performed on that view. | ||
* To have dynamic aggregation: | ||
|
||
* with ``FigureResampler``, you need to call ``show_dash`` (or output the object in a cell via ``IPython.display``) -> which spawns a dash-web app, and the dynamic aggregation is realized with dash callback | ||
* with ``FigureWidgetResampler``, you need to use ``IPython.display`` on the object, which uses widget-events to realize dynamic aggregation (via the running IPython kernel). | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
</details> | ||
<br> | ||
<details> | ||
<summary> | ||
<a><b>What does <code><a href="https://github.com/predict-idlab/trace-updater" target="_blank">TraceUpdater</a></code> do?</b></a> | ||
</summary> | ||
<div style="margin-left:1em"> | ||
|
||
The ``TraceUpdater`` class is a custom dash component that aids ``dcc.Graph`` components to efficiently send and update (in our case aggregated) data to the front-end. | ||
|
||
For more information on how to use the trace-updater component together with the ``FigureResampler``, see our dash app `examples <https://github.com/predict-idlab/plotly-resampler/tree/main/examples>`_` and look at the `trace-updater <https://github.com/predict-idlab/trace-updater/blob/master/trace_updater/TraceUpdater.py>`_ its documentation. | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
</details> | ||
<br> | ||
<details> | ||
<summary> | ||
<a><b>What is the difference in approach between plotly-resampler and datashader?</b></a> | ||
</summary> | ||
<div style="margin-left:1em"> | ||
|
||
|
||
`Datashader <https://datashader.org/getting_started/Introduction.html>`_ is a highly scalable `open-source <https://github.com/holoviz/datashader>`_ library for analyzing and visualizing large datasets. More specifically, datashader *“rasterizes”* or *“aggregates”* datasets into regular grids that can be analyzed further or viewed as **images**. | ||
|
||
|
||
**The main differences are**: | ||
|
||
Datashader can deal with various kinds of data (e.g., location related data, point clouds), whereas plotly-resampler is more tailored towards time-series data visualizations. | ||
Furthermore, datashader outputs a **rasterized image/array** encompassing all traces their data, whereas plotly-resampler outputs an **aggregated series** per trace. Thus, datashader is more suited for analyzing data where you do not want to pin-out a certain series/trace. | ||
|
||
In our opinion, datashader truly shines (for the time series use case) when: | ||
|
||
* you want a global, overlaying view of all your traces | ||
* you want to visualize a large number of time series in a single plot (many traces) | ||
* there is a lot of noise on your high-frequency data and you want to uncover the underlying pattern | ||
* you want to render all data points in your visualization | ||
|
||
In our opinion, plotly-resampler shines when: | ||
|
||
* you need the capabilities to interact with the traces (e.g., hovering, toggling traces, hovertext per trace) | ||
* you want to use a less complex (but more restricted) visualization interface (as opposed to holoviews), i.e., plotly | ||
* you want to make existing plotly time-series figures more scalable and efficient | ||
* to build scalable Dash apps for time-series data visualization | ||
|
||
Furthermore combined with holoviews, datashader can also be employed in an interactive manner, see the example below. | ||
|
||
.. code:: python | ||
from holoviews.operation.datashader import datashade | ||
import datashader as ds | ||
import holoviews as hv | ||
import numpy as np | ||
import pandas as pd | ||
import panel as pn | ||
hv.extension("bokeh") | ||
pn.extension(comms='ipywidgets') | ||
# Create the dummy dataframe | ||
n = 1_000_000 | ||
x = np.arange(n) | ||
noisy_sine = (np.sin(x / 3_000) + (np.random.randn(n) / 10)) * x / 5_000 | ||
df = pd.DataFrame( | ||
{"ns": noisy_sine, "ns_abs": np.abs(noisy_sine),} | ||
) | ||
# Visualize interactively with datashader | ||
opts = hv.opts.RGB(width=800, height=400) | ||
ndoverlay = hv.NdOverlay({c:hv.Curve((df.index, df[c])) for c in df.columns}) | ||
datashade(ndoverlay, cnorm='linear', aggregator=ds.count(), line_width=3).opts(opts) | ||
.. image:: _static/datashader.png | ||
|
||
|
||
.. raw:: html | ||
|
||
</div> | ||
</details> | ||
<br> | ||
<details> | ||
<summary> | ||
<a><b>I get errors such as:</b><br><ul><li> | ||
<code>RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe</code></li> | ||
<li><code>ImportError: numpy.core.multiarray failed to import</code></li> | ||
</ul> | ||
</a> | ||
</summary> | ||
<div style="margin-left:1em"> | ||
|
||
Plotly-resampler uses compiled C code (which uses the NumPy C API) to speed up the LTTB data-aggregation algorithm. This C code gets compiled during the building stage of the package (which might be before you install the package).<br><br> | ||
If this C extension was build against a more recent NumPy version than your local version, you obtain a | ||
<a href="https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility"><i>NumPy C-API incompatibility</i></a> | ||
and the above error will be raised.<br><br> | ||
|
||
These above mentioned errors can thus be resolved by running<br> | ||
<code>pip install --upgrade numpy</code><br> | ||
and reinstalling plotly-resampler afterwards.<br><br> | ||
|
||
For more information about compatibility and building upon NumPy, you can consult | ||
<a href="https://numpy.org/doc/stable/user/depending_on_numpy.html?highlight=compiled#for-downstream-package-authors">NumPy's docs for downstream package authors</a>. | ||
|
||
We aim to limit this issue as much as possible (by for example using <a href="https://github.com/scipy/oldest-supported-numpy">oldest-supported-numpy</a> in our build.py), | ||
but if you still experience issues, please open an issue on <a href="https://github.com/predict-idlab/plotly-resampler/issues">GitHub</a>. | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
</details> | ||
<br> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.