A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews

Overview

hvPlot

A high-level plotting API for the PyData ecosystem built on HoloViews.

Build Status Build Status
Coverage Coverage Status
Latest dev release Github tag
Latest release Github release PyPI version hvplot version conda-forge version defaults version
Docs gh-pages site

What is it?

The PyData ecosystem has a number of core Python data containers that allow users to work with a wide array of datatypes, including:

  • Pandas: DataFrame, Series (columnar/tabular data)
  • XArray: Dataset, DataArray (multidimensional arrays)
  • Dask: DataFrame, Series, Array (distributed/out of core arrays and columnar data)
  • Streamz: DataFrame(s), Series(s) (streaming columnar data)
  • Intake: DataSource (data catalogues)
  • GeoPandas: GeoDataFrame (geometry data)
  • NetworkX: Graph (network graphs)

Several of these libraries have the concept of a high-level plotting API that lets a user generate common plot types very easily. The native plotting APIs are generally built on Matplotlib, which provides a solid foundation, but means that users miss out the benefits of modern, interactive plotting libraries for the web like Bokeh and HoloViews.

hvPlot provides a high-level plotting API built on HoloViews that provides a general and consistent API for plotting data in all the abovementioned formats. hvPlot can integrate neatly with the individual libraries if an extension mechanism for the native plot APIs is offered, or it can be used as a standalone component.

To start using hvplot have a look at the Getting Started Guide and check out the current functionality in the User Guide.

Installation

hvPlot supports Python 2.7, 3.5, 3.6 and 3.7 on Linux, Windows, or Mac and can be installed with conda:

conda install -c pyviz hvplot

or with pip:

pip install hvplot

In the classic Jupyter notebook environment and JupyterLab objects returned by hvPlot will then render themselves if they are the last item in a notebook cell. For versions of jupyterlab>=3.0 the necessary extension is automatically bundled in the pyviz_comms package, which must be >=2.0. However note that for version of jupyterlab<3.0 you must also manually install the JupyterLab extension with:

jupyter labextension install @pyviz/jupyterlab_pyviz
Comments
  • Toggle holoplot when using within Jupyter notebook

    Toggle holoplot when using within Jupyter notebook

    This issue is a follow up on this SO answer as per @philippjfr request. Please keep in mind it's the first time I'm using holoplot (which seems to be awesome!)

    I tried to use holoplot from within a Jupyter notebook. Once importing the package using

    import holoplot.pandas
    

    all .plot are going through holoplot. This is not always a convenient behavior. Sometimes, it is easy to think of a use case where some cells should be using holoplot while others will be rendered using the standard matplotlib. I hope this issue is good enough as a starting point for an interesting discussion.

    opened by drorata 37
  • sample_data try/except import wrapper fails

    sample_data try/except import wrapper fails

    ALL software version info

    hvplot: 0.7.3

    Description of expected behavior and the observed behavior

    The following import fails, despite the all-catching except in the code?? (Honestly stumped)

    from hvplot.sample_data import us_crime, airline_flights
    
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    /tmp/ipykernel_3185062/1788543639.py in <module>
    ----> 1 from hvplot.sample_data import us_crime, airline_flights
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/hvplot/sample_data.py in <module>
         23 # Add catalogue entries to namespace
         24 for _c in catalogue:
    ---> 25     globals()[_c] = catalogue[_c]
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/base.py in __getitem__(self, key)
        398             if e.container == 'catalog':
        399                 return e(name=key)
    --> 400             return e()
        401         if isinstance(key, str) and '.' in key:
        402             key = key.split('.')
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/entry.py in __call__(self, persist, **kwargs)
         75             raise ValueError('Persist value (%s) not understood' % persist)
         76         persist = persist or self._pmode
    ---> 77         s = self.get(**kwargs)
         78         if persist != 'never' and isinstance(s, PersistMixin) and s.has_been_persisted:
         79             from ..container.persist import store
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in get(self, **user_parameters)
        287             return self._default_source
        288 
    --> 289         plugin, open_args = self._create_open_args(user_parameters)
        290         data_source = plugin(**open_args)
        291         data_source.catalog_object = self._catalog
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in _create_open_args(self, user_parameters)
        261 
        262         if len(self._plugin) == 0:
    --> 263             raise ValueError('No plugins loaded for this entry: %s\n'
        264                              'A listing of installable plugins can be found '
        265                              'at https://intake.readthedocs.io/en/latest/plugin'
    
    ValueError: No plugins loaded for this entry: parquet
    A listing of installable plugins can be found at https://intake.readthedocs.io/en/latest/plugin-directory.html .
    

    For reference, this is the code in 0.7.3:

    import os
    
    try:
        from intake import open_catalog
    except:
        raise ImportError('Loading hvPlot sample data requires intake '
                          'and intake-parquet. Install it using conda or '
                          'pip before loading data.')
    

    How can intake throw a ValueError??

    Complete, minimal, self-contained example code that reproduces the issue

    • Have only the package intake installed, no other intake-subpackages.
    • Execute : from hvplot.sample_data import us_crime, airline_flights
    # code goes here between backticks
    from hvplot.sample_data import us_crime, airline_flights
    

    Stack traceback and/or browser JavaScript console output

    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    /tmp/ipykernel_3185062/1788543639.py in <module>
    ----> 1 from hvplot.sample_data import us_crime, airline_flights
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/hvplot/sample_data.py in <module>
         23 # Add catalogue entries to namespace
         24 for _c in catalogue:
    ---> 25     globals()[_c] = catalogue[_c]
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/base.py in __getitem__(self, key)
        398             if e.container == 'catalog':
        399                 return e(name=key)
    --> 400             return e()
        401         if isinstance(key, str) and '.' in key:
        402             key = key.split('.')
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/entry.py in __call__(self, persist, **kwargs)
         75             raise ValueError('Persist value (%s) not understood' % persist)
         76         persist = persist or self._pmode
    ---> 77         s = self.get(**kwargs)
         78         if persist != 'never' and isinstance(s, PersistMixin) and s.has_been_persisted:
         79             from ..container.persist import store
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in get(self, **user_parameters)
        287             return self._default_source
        288 
    --> 289         plugin, open_args = self._create_open_args(user_parameters)
        290         data_source = plugin(**open_args)
        291         data_source.catalog_object = self._catalog
    
    ~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in _create_open_args(self, user_parameters)
        261 
        262         if len(self._plugin) == 0:
    --> 263             raise ValueError('No plugins loaded for this entry: %s\n'
        264                              'A listing of installable plugins can be found '
        265                              'at https://intake.readthedocs.io/en/latest/plugin'
    
    ValueError: No plugins loaded for this entry: parquet
    A listing of installable plugins can be found at https://intake.readthedocs.io/en/latest/plugin-directory.html .
    

    Additional info

    The list of required package is now this:

    • intake-parquet
    • intake-xarray
    • s3fs
    opened by michaelaye 26
  • hvplot is not using lazy loading for zarr-backed xarray dataset

    hvplot is not using lazy loading for zarr-backed xarray dataset

    ALL software version info

    xr.__version__
    '0.21.1'
    hvplot.__version__
    '0.7.3'
    holoviews.__version__
    '1.14.7'
    

    Description of expected behavior and the observed behavior

    When I visualize zarr-backed xarray datasets with hvplot, I expect the loading to be lazy. I don't want to load the entire array into memory. I expect this to happen even without dask being involved.

    Instead, I am noticing that hvplot is loading data eagerly.

    Complete, minimal, self-contained example code that reproduces the issue

    import xarray as xr
    import hvplot.xarray
    
    url = "https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/swot_adac/FESOM/surf/fma.zarr"
    ds = xr.open_dataset(url, engine='zarr') # note that ds is not chunked but still uses lazy loading
    
    # this will trigger loading the whole array into memory
    ds.sst.hvplot(x='lon', y='lat', dynamic=True, rasterize=True)
    

    Note that lazyness can be achieved by chunking the xarray dataset. But I don't want to have to do that. Dask introduces additional latency that I would like to avoid here.

    type: discussion 
    opened by rabernat 19
  • Adding datashade and rasterize options to scatter_matrix

    Adding datashade and rasterize options to scatter_matrix

    Fixes #114

    @tonyfast, @jlstevens and I worked through a solution to add a datashade option for a hvplot scatter_matrix. @jlstevens pointed out datashade options (aggregator, rasterize, etc) may need to be considered when implementing this. This PR, so far, only includes an argument to set datashade = True in the call to scatter_matrix, which will then use grid.apply(datashade, per_element=True), as @philippjfr suggested as a solution in the issue.

    opened by ppwadhwa 17
  • Adds docstrings to the `core` module

    Adds docstrings to the `core` module

    This PR aims to add better docstring for users. It does this by providing more descriptive text, examples and reference links similar to the docstrings recently added to Panel.

    I will try to stick to the reference example below.

    image

    As a user I would like to understand

    • what the plot is
    • be guided when to use it
    • How this can be used
      • understand the available options and parameters and how to find out more about them
    • Quickly be able to learn more about the type of plot in general (wikipedia) and in particular for the selected backend.

    As a developer or supporter on Discourse working on the specific plot it is very helpful to be able to find the Pandas .plot and backend references quickly.

    For beginners the docstring should contain just enough information to get a general idea of what this is and if it is the right plot to use. For more info they can head of to the reference documentation.

    For super users the docstring should have just enough information to refresh your memory and be able to work. And we should be able to navigate without to much context switching. When you have to leave your editor or IDE there is a cost.

    Many users (my self included) have not been educated abstractly (we might have concretely) in data visualization. I.e. we might not know the right terms, the right plot to use for the kind of data, not understand why we cannot make a bar plot from non-categorical data when that is normal for other frameworks to support etc. So the docs should help guide and share knowledge.

    in progress 
    opened by MarcSkovMadsen 16
  • hvplot pickle incompatible

    hvplot pickle incompatible

    Describe the bug

    I have a collection of holoviews and hvplot plots that I'd like to pickle and store for later retrieval, ideally including all styles/customizations.

    With holoviews, this can easily be done with using either pickle or hv.Store - where the first stores the core holoviews obj and the latter includes the holoviews options to persist style/customizations.

    However, neither pickle or hv.Store seem to work with hvplot plots.

    Steps/Code to reproduce bug

    Create a hvplot:

    import numpy as np
    import pandas as pd
    import hvplot.pandas
    
    df = pd.DataFrame(np.random.randn(1000, 4), columns=list('ABCD')).cumsum()
    hv_plot_example = df.hvplot()
    hv_plot_example
    

    Try to pickle the plot:

    import pickle
    
    plot_bytes = pickle.dumps(hv_plot_example)
    

    or

    import holoviews as hv
    
    plot_bytes = hv.Store.dumps(hv_plot_example)
    

    Both throw the following AttributeError:

    AttributeError: Can't pickle local object Redim._create_expression_transform.<locals>._transform_expression
    

    Expected behavior

    I would like to be able to pickle the hvplot directly so that I can persist in for retrieval later. Without this functionality, I'm limited to writing plots to temporary .png files and storing those rather than the pickled object.

    Additional Context

    holoviews supports this functionality as the following example works perfectly:

    import holoviews as hv
    hv.extension('bokeh')
    
    holo_plot_example = hv.Overlay()
    for column in list(df):
        ys = df[column].values
        holo_plot_example *= hv.Curve(ys).opts(title="Test")
        
    holo_plot_example
    

    which can be pickled with either:

    import pickle
    
    holo_plot_pickle = pickle.dumps(holo_plot_example)
    pickle.loads(holo_plot_pickle)
    

    or

    holo_plot_store_pickle = hv.Store.dumps(holo_plot_example)
    hv.Store.loads(holo_plot_store_pickle)
    
    type: enhancement 
    opened by joe-wolfe21 15
  • hvplot.image() zoom causes axes limits to bounce around

    hvplot.image() zoom causes axes limits to bounce around

    Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at Discourse instead. Issues without the required information below may be closed immediately.

    ALL software version info

    hvplot 0.5.2 bokeh 2.0.1

    Description of expected behavior and the observed behavior

    Plotting image results in axes and colorbar limits jumping around. A zoom box draw partially outside valid pixels of image causes further jumping around of axes limits.

    Complete, minimal, self-contained example code that reproduces the issue

    https://gist.github.com/scottyhq/0e245fcd62d8a46b82a4186fcd8945e6#file-hvplot-zoom-ipynb

    # Lots of window and colorbar rescaling happening when first plot, and upon zooming
    band1.hvplot.image(x='x',y='y',
                       crs='epsg:32645', 
                       tiles='OSM', 
                       rasterize=True,
                       width=700, height=500, 
                       cmap='plasma', 
                       logz=True,
                       alpha=0.7)
    

    Stack traceback and/or browser JavaScript console output

    No error or traceback, but the behavior is buggy. See gif:

    Screenshots or screencasts of the bug in action

    hvplotzoom

    type: bug 
    opened by scottyhq 15
  • No output in jupyter notebook -suddenly

    No output in jupyter notebook -suddenly

    Using python 3.6 on Linux with

    • holoviews 1.13.2
    • hvplot 0.5.2
    • bokeh 2.0.2
    • IPython 7.1.1

    When I do something simple like:

    df.hvplot(kind="scatter")
    

    A red "Out[nn]" is shown and nothing else. This frequently happens in notebooks where the same plot showed fine earlier. At some point it stopped working.

    Under my imports:

    import holoviews as hv
    hv.extension("bokeh")
    import hvplot
    import hvplot.pandas
    

    The following messages are shown:

    Javascript error adding output!
    TypeError: Bokeh.set_log_level is not a function
    See your browser Javascript console for more details
    

    On the Chrome javascript console there are many warnings and the following errors:

    Uncaught TypeError: Cannot read property 'embed_items_notebook' of undefined 
        at embed_document (<anonymous>:5:20)
        at <anonymous>:8:5
        at <anonymous>:24:3
        at eval (eval at append_javascript (outputarea.js:763), <anonymous>:97:28)
        at Array.forEach (<anonymous>)
        at window._Events.handle_add_output (eval at append_javascript (outputarea.js:763), <anonymous>:86:13)
        at window._Events.dispatch (jquery.min.js:5237)
        at window._Events.elemData.handle (jquery.min.js:5044)
        at Object.trigger (jquery.min.js:8471)
        at window._Events.<anonymous> (jquery.min.js:8549)
    events.js:33 Exception in event handler for output_added.OutputArea TypeError: Cannot use 'in' operator to search for '1754' in undefined
        at window._Events.handle_add_output (eval at append_javascript (outputarea.js:763), <anonymous>:103:45)
        at window._Events.dispatch (jquery.min.js:5237)
        at window._Events.elemData.handle (jquery.min.js:5044)
        at Object.trigger (jquery.min.js:8471)
        at window._Events.<anonymous> (jquery.min.js:8549)
        at Function.each (jquery.min.js:367)
        at jQuery.fn.init.each (jquery.min.js:202)
        at jQuery.fn.init.trigger (jquery.min.js:8548)
        at jQuery.fn.init.events.trigger (events.js:31)
        at OutputArea.append_output (outputarea.js:355) Arguments(2)
    

    In the Firefox console I see the following errors:

    Comm promise not found for comm id hv-extension-comm comm.js:127
        comm_msg comm.js:127
        proxy jQuery
        _handle_iopub_message kernel.js:1224
        _finish_ws_message kernel.js:1016
        _msg_queue kernel.js:1007
    TypeError: root.Bokeh.embed is undefinedplotting-libs.ipynb line 97 > scriptElement:5:3
        embed_document plotting-libs.ipynb line 97 > scriptElement:5
        <anonymous> plotting-libs.ipynb line 97 > scriptElement:8
        <anonymous> plotting-libs.ipynb line 97 > scriptElement:24
        handle_add_output main.min.js:97
        forEach self-hosted:225
        handle_add_output main.min.js:86
        jQuery 7
        trigger events.js:31
        append_output outputarea.js:355
        fromJSON outputarea.js:1046
        fromJSON codecell.js:564
        fromJSON notebook.js:2660
        load_notebook_success notebook.js:3146
        proxy jQuery
    Exception in event handler for output_added.OutputArea TypeError: "right-hand side of 'in' should be an object, got undefined"
        handle_add_output main.min.js:103
        jQuery 7
        trigger events.js:31
        append_output outputarea.js:355
        fromJSON outputarea.js:1046
        fromJSON codecell.js:564
        fromJSON notebook.js:2660
        load_notebook_success notebook.js:3146
        proxy jQuery
    

    What I find frustrating is that the same notebook worked fine a bit earlier and there is nothing obvious that has been changed to explain why it suddenly does not work and no helpful error message as to what might be going wrong.

    type: bug 
    opened by johann-petrak 14
  • Quadmesh + datashader + dask raises numba error

    Quadmesh + datashader + dask raises numba error

    ALL software version info

    I am using the latest released versions of all the relevant libraries.

    Hvplot 0.5.2 Datshader 0.10.0 Numba 0.48.0

    Description of expected behavior and the observed behavior

    Complete, minimal, self-contained example code that reproduces the issue

    I am trying to plot an xarray dataset backed by dask using hvplot. Here is how I load the data. (Should be reproducible with intake installed.)

    from intake import open_catalog
    cat = open_catalog("https://raw.githubusercontent.com/pangeo-data/pangeo-datastore/master/intake-catalogs/ocean.yaml")
    ds  = cat["sea_surface_height"].to_dask()
    

    The following code works fine:

    ds.sla.hvplot.image('longitude', 'latitude', rasterize=True, dynamic=True)
    

    However, if I try to do quadmesh instead

    ds.sla.hvplot.quadmesh('longitude', 'latitude', rasterize=True, dynamic=True)
    

    I get a big long error.

    Stack traceback and/or browser JavaScript console output

    WARNING:param.dynamic_operation: Callable raised "TypingError('Failed in nopython mode pipeline (step: nopython frontend)\nnon-precise type pyobject\n[1] During: typing of argument at <extend_cpu> (4)\n\nFile "<extend_cpu>", line 4:\n<source missing, REPL/exec in use?>\n\nThis error may have been caused by the following argument(s):\n- argument 4: cannot determine Numba type of <class \'dask.array.core.Array\'>\n')".
    Invoked as dynamic_operation(numpy.datetime64('1993-01-01T00:00:00.000000000'), height=300, scale=1.0, width=700, x_range=None, y_range=None)
    WARNING:param.dynamic_operation: Callable raised "TypingError('Failed in nopython mode pipeline (step: nopython frontend)\nnon-precise type pyobject\n[1] During: typing of argument at <extend_cpu> (4)\n\nFile "<extend_cpu>", line 4:\n<source missing, REPL/exec in use?>\n\nThis error may have been caused by the following argument(s):\n- argument 4: cannot determine Numba type of <class \'dask.array.core.Array\'>\n')".
    Invoked as dynamic_operation(numpy.datetime64('1993-01-01T00:00:00.000000000'), height=300, scale=1.0, width=700, x_range=None, y_range=None)
    ---------------------------------------------------------------------------
    TypingError                               Traceback (most recent call last)
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj, include, exclude)
        968 
        969             if method is not None:
    --> 970                 return method(include=include, exclude=exclude)
        971             return None
        972         else:
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/dimension.py in _repr_mimebundle_(self, include, exclude)
       1302         combined and returned.
       1303         """
    -> 1304         return Store.render(self)
       1305 
       1306 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/options.py in render(cls, obj)
       1393         data, metadata = {}, {}
       1394         for hook in hooks:
    -> 1395             ret = hook(obj)
       1396             if ret is None:
       1397                 continue
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/ipython/display_hooks.py in pprint_display(obj)
        280     if not ip.display_formatter.formatters['text/plain'].pprint:
        281         return None
    --> 282     return display(obj, raw_output=True)
        283 
        284 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/ipython/display_hooks.py in display(obj, raw_output, **kwargs)
        256     elif isinstance(obj, (HoloMap, DynamicMap)):
        257         with option_state(obj):
    --> 258             output = map_display(obj)
        259     elif isinstance(obj, Plot):
        260         output = render(obj)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/ipython/display_hooks.py in wrapped(element)
        144         try:
        145             max_frames = OutputSettings.options['max_frames']
    --> 146             mimebundle = fn(element, max_frames=max_frames)
        147             if mimebundle is None:
        148                 return {}, {}
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/ipython/display_hooks.py in map_display(vmap, max_frames)
        204         return None
        205 
    --> 206     return render(vmap)
        207 
        208 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/ipython/display_hooks.py in render(obj, **kwargs)
         66         renderer = renderer.instance(fig='png')
         67 
    ---> 68     return renderer.components(obj, **kwargs)
         69 
         70 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/plotting/renderer.py in components(self, obj, fmt, comm, **kwargs)
        363             doc = Document()
        364             with config.set(embed=embed):
    --> 365                 model = plot.layout._render_model(doc, comm)
        366             return render_model(model, comm) if embed else render_mimebundle(model, doc, comm)
        367         else:
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/panel/viewable.py in _render_model(self, doc, comm)
        363         if comm is None:
        364             comm = state._comm_manager.get_server_comm()
    --> 365         model = self.get_root(doc, comm)
        366 
        367         if config.embed:
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/panel/viewable.py in get_root(self, doc, comm)
        534         """
        535         doc = doc or _curdoc()
    --> 536         root = self._get_model(doc, comm=comm)
        537         self._preprocess(root)
        538         ref = root.ref['id']
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/panel/layout.py in _get_model(self, doc, root, parent, comm)
        134         if root is None:
        135             root = model
    --> 136         objects = self._get_objects(model, [], doc, root, comm)
        137         props = dict(self._init_properties(), objects=objects)
        138         model.update(**self._process_param_change(props))
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/panel/layout.py in _get_objects(self, model, old_objects, doc, root, comm)
        124             else:
        125                 try:
    --> 126                     child = pane._get_model(doc, root, model, comm)
        127                 except RerenderError:
        128                     return self._get_objects(model, current_objects[:i], doc, root, comm)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/panel/pane/holoviews.py in _get_model(self, doc, root, parent, comm)
        225             plot = self.object
        226         else:
    --> 227             plot = self._render(doc, comm, root)
        228 
        229         plot.pane = self
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/panel/pane/holoviews.py in _render(self, doc, comm, root)
        284             kwargs = {}
        285 
    --> 286         return renderer.get_plot(self.object, **kwargs)
        287 
        288     def _cleanup(self, root):
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/plotting/bokeh/renderer.py in get_plot(self_or_cls, obj, doc, renderer, **kwargs)
         71         combining the bokeh model with another plot.
         72         """
    ---> 73         plot = super(BokehRenderer, self_or_cls).get_plot(obj, doc, renderer, **kwargs)
         74         if plot.document is None:
         75             plot.document = Document() if self_or_cls.notebook_context else curdoc()
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/plotting/renderer.py in get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
        200 
        201         # Initialize DynamicMaps with first data item
    --> 202         initialize_dynamic(obj)
        203 
        204         if not renderer:
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/plotting/util.py in initialize_dynamic(obj)
        249             continue
        250         if not len(dmap):
    --> 251             dmap[dmap._initial_key()]
        252 
        253 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/spaces.py in __getitem__(self, key)
       1278         # Not a cross product and nothing cached so compute element.
       1279         if cache is not None: return cache
    -> 1280         val = self._execute_callback(*tuple_key)
       1281         if data_slice:
       1282             val = self._dataslice(val, data_slice)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/spaces.py in _execute_callback(self, *args)
       1052 
       1053         with dynamicmap_memoization(self.callback, self.streams):
    -> 1054             retval = self.callback(*args, **kwargs)
       1055         return self._style(retval)
       1056 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/spaces.py in __call__(self, *args, **kwargs)
        691 
        692         try:
    --> 693             ret = self.callable(*args, **kwargs)
        694         except KeyError:
        695             # KeyError is caught separately because it is used to signal
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/util/__init__.py in dynamic_operation(*key, **kwargs)
        983 
        984         def dynamic_operation(*key, **kwargs):
    --> 985             key, obj = resolve(key, kwargs)
        986             return apply(obj, *key, **kwargs)
        987 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/util/__init__.py in resolve(key, kwargs)
        976             elif isinstance(map_obj, DynamicMap) and map_obj._posarg_keys and not key:
        977                 key = tuple(kwargs[k] for k in map_obj._posarg_keys)
    --> 978             return key, map_obj[key]
        979 
        980         def apply(element, *key, **kwargs):
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/spaces.py in __getitem__(self, key)
       1278         # Not a cross product and nothing cached so compute element.
       1279         if cache is not None: return cache
    -> 1280         val = self._execute_callback(*tuple_key)
       1281         if data_slice:
       1282             val = self._dataslice(val, data_slice)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/spaces.py in _execute_callback(self, *args)
       1052 
       1053         with dynamicmap_memoization(self.callback, self.streams):
    -> 1054             retval = self.callback(*args, **kwargs)
       1055         return self._style(retval)
       1056 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/spaces.py in __call__(self, *args, **kwargs)
        691 
        692         try:
    --> 693             ret = self.callable(*args, **kwargs)
        694         except KeyError:
        695             # KeyError is caught separately because it is used to signal
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/util/__init__.py in dynamic_operation(*key, **kwargs)
        984         def dynamic_operation(*key, **kwargs):
        985             key, obj = resolve(key, kwargs)
    --> 986             return apply(obj, *key, **kwargs)
        987 
        988         operation = self.p.operation
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/util/__init__.py in apply(element, *key, **kwargs)
        980         def apply(element, *key, **kwargs):
        981             kwargs = dict(util.resolve_dependent_kwargs(self.p.kwargs), **kwargs)
    --> 982             return self._process(element, key, kwargs)
        983 
        984         def dynamic_operation(*key, **kwargs):
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/util/__init__.py in _process(self, element, key, kwargs)
        962         elif isinstance(self.p.operation, Operation):
        963             kwargs = {k: v for k, v in kwargs.items() if k in self.p.operation.param}
    --> 964             return self.p.operation.process_element(element, key, **kwargs)
        965         else:
        966             return self.p.operation(element, **kwargs)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/operation.py in process_element(self, element, key, **params)
        170             self.p = param.ParamOverrides(self, params,
        171                                           allow_extra_keywords=self._allow_extra_keywords)
    --> 172         return self._apply(element, key)
        173 
        174 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/operation.py in _apply(self, element, key)
        130         element_pipeline = getattr(element, '_pipeline', None)
        131 
    --> 132         ret = self._process(element, key)
        133         for hook in self._postprocess_hooks:
        134             ret = hook(self, ret, **kwargs)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/operation/datashader.py in _process(self, element, key)
       1413                                        if k in transform.param})
       1414             op._precomputed = self._precomputed
    -> 1415             element = element.map(op, predicate)
       1416             self._precomputed = op._precomputed
       1417 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/data/__init__.py in pipelined_fn(*args, **kwargs)
        212 
        213             try:
    --> 214                 result = method_fn(*args, **kwargs)
        215 
        216                 op = method_op.instance(
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/data/__init__.py in map(self, *args, **kwargs)
       1167 
       1168     def map(self, *args, **kwargs):
    -> 1169         return super(Dataset, self).map(*args, **kwargs)
       1170     map.__doc__ = LabelledData.map.__doc__
       1171 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/dimension.py in map(self, map_fn, specs, clone)
        703             return deep_mapped
        704         else:
    --> 705             return map_fn(self) if applies else self
        706 
        707 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/operation.py in __call__(self, element, **kwargs)
        190             elif ((self._per_element and isinstance(element, Element)) or
        191                   (not self._per_element and isinstance(element, ViewableElement))):
    --> 192                 return self._apply(element)
        193         elif 'streams' not in kwargs:
        194             kwargs['streams'] = self.p.streams
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/core/operation.py in _apply(self, element, key)
        130         element_pipeline = getattr(element, '_pipeline', None)
        131 
    --> 132         ret = self._process(element, key)
        133         for hook in self._postprocess_hooks:
        134             ret = hook(self, ret, **kwargs)
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/holoviews/operation/datashader.py in _process(self, element, key)
       1081 
       1082         vdim = getattr(agg_fn, 'column', element.vdims[0].name)
    -> 1083         agg = cvs.quadmesh(data[vdim], x.name, y.name, agg_fn)
       1084         xdim, ydim = list(agg.dims)[:2][::-1]
       1085         if xtype == "datetime":
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/core.py in quadmesh(self, source, x, y, agg)
        770                 dims=list(xarr.dims)))
        771 
    --> 772         return bypixel(source, self, glyph, agg)
        773 
        774     # TODO re 'untested', below: Consider replacing with e.g. a 3x3
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/core.py in bypixel(source, canvas, glyph, agg)
       1159     with np.warnings.catch_warnings():
       1160         np.warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
    -> 1161         return bypixel.pipeline(source, schema, canvas, glyph, agg)
       1162 
       1163 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/utils.py in __call__(self, head, *rest, **kwargs)
         91         typ = type(head)
         92         if typ in lk:
    ---> 93             return lk[typ](head, *rest, **kwargs)
         94         for cls in getmro(typ)[1:]:
         95             if cls in lk:
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/data_libraries/xarray.py in xarray_pipeline(df, schema, canvas, glyph, summary)
         17 def xarray_pipeline(df, schema, canvas, glyph, summary):
         18     cuda = cupy and isinstance(df[glyph.name].data, cupy.ndarray)
    ---> 19     return glyph_dispatch(glyph, df, schema, canvas, summary, cuda)
         20 
         21 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/utils.py in __call__(self, head, *rest, **kwargs)
         94         for cls in getmro(typ)[1:]:
         95             if cls in lk:
    ---> 96                 return lk[cls](head, *rest, **kwargs)
         97         raise TypeError("No dispatch for {0} type".format(typ))
         98 
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/data_libraries/pandas.py in default(glyph, source, schema, canvas, summary, cuda)
         43 
         44     bases = create((height, width))
    ---> 45     extend(bases, source, x_st + y_st, x_range + y_range)
         46 
         47     return finalize(bases,
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/datashader/glyphs/quadmesh.py in extend(aggs, xr_ds, vt, bounds)
        186                 do_extend = extend_cpu
        187 
    --> 188             do_extend(xs, ys, *aggs_and_cols)
        189 
        190         return extend
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)
        399                 e.patch_message(msg)
        400 
    --> 401             error_rewrite(e, 'typing')
        402         except errors.UnsupportedError as e:
        403             # Something unsupported is present in the user code, add help info
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/numba/dispatcher.py in error_rewrite(e, issue_type)
        342                 raise e
        343             else:
    --> 344                 reraise(type(e), e, None)
        345 
        346         argtypes = []
    
    /srv/conda/envs/pangeo/lib/python3.7/site-packages/numba/six.py in reraise(tp, value, tb)
        666             value = tp()
        667         if value.__traceback__ is not tb:
    --> 668             raise value.with_traceback(tb)
        669         raise value
        670 
    
    TypingError: Failed in nopython mode pipeline (step: nopython frontend)
    non-precise type pyobject
    [1] During: typing of argument at <extend_cpu> (4)
    
    File "<extend_cpu>", line 4:
    <source missing, REPL/exec in use?>
    
    This error may have been caused by the following argument(s):
    - argument 4: cannot determine Numba type of <class 'dask.array.core.Array'>
    

    I recognize that the best place for this issue might be in another repo, but I thought I would try here first.

    opened by rabernat 14
  • hvplot is not compatible with latest release of bokeh

    hvplot is not compatible with latest release of bokeh

    Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at Discourse instead. Issues without the required information below may be closed immediately.

    ALL software version info

    (this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc) bokeh 2.0.0, python 3.7.6, hvplot 0.5.2

    Description of expected behavior and the observed behavior

    hvplot 0.5.2 is not compatible with bokeh 2.0.0, giving the following error message:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/yy939/mgh/miniconda3/envs/pegasus-github/lib/python3.7/site-packages/hvplot/__init__.py", line 12, in <module>
        from .converter import HoloViewsConverter
      File "/Users/yy939/mgh/miniconda3/envs/pegasus-github/lib/python3.7/site-packages/hvplot/converter.py", line 25, in <module>
        from holoviews.plotting.bokeh import OverlayPlot
      File "/Users/yy939/mgh/miniconda3/envs/pegasus-github/lib/python3.7/site-packages/holoviews/plotting/bokeh/__init__.py", line 30, in <module>
        from .annotation import (TextPlot, LineAnnotationPlot, SplinePlot,
      File "/Users/yy939/mgh/miniconda3/envs/pegasus-github/lib/python3.7/site-packages/holoviews/plotting/bokeh/annotation.py", line 23, in <module>
        from .element import AnnotationPlot, ElementPlot, CompositeElementPlot, ColorbarPlot
      File "/Users/yy939/mgh/miniconda3/envs/pegasus-github/lib/python3.7/site-packages/holoviews/plotting/bokeh/element.py", line 23, in <module>
        from bokeh.plotting.helpers import _known_tools as known_tools
    ModuleNotFoundError: No module named 'bokeh.plotting.helpers'
    

    But it's compatible with bokeh 1.4.0.

    Complete, minimal, self-contained example code that reproduces the issue

    pip install --upgrade hvplot
    pip install --upgrade bokeh
    python
    >>> import hvplot
    

    Stack traceback and/or browser JavaScript console output

    Screenshots or screencasts of the bug in action

    opened by yihming 13
  • Updates the readme

    Updates the readme

    This is an attempt to

    • sharpen the elevator pitch
    • describe hvPlot as it is today
    • Make the communication more engaging using examples and images
    • Make it easy to find what you need via menus and links.
    • Mention hvPlot as the entry point to the HoloViz ecosystem (See https://github.com/holoviz/hvplot/issues/533).

    You can see the README rendered here.

    Additional Context

    Maybe the rest of the HoloViz ecosystem READMEs could need a similar update?

    opened by MarcSkovMadsen 12
  • interactive DataFrame: .loc with interactive boolean Series and column not working

    interactive DataFrame: .loc with interactive boolean Series and column not working

    Versions

    hvplot = 0.8.2

    Description

    the .loc method can take a row plus a column parameter in Pandas. When using an interactive DataFrame, this behavior should be conserved. But when using an interactive boolean Series as the row parameter, specifying a column leads to an error message.

    Example

    import hvplot.pandas
    from bokeh.sampledata.penguins import data as df
    
    dfi = df.interactive()
    
    # ERROR
    dfi.loc[dfi['body_mass_g'] > 4000,'bill_length_mm']         #  interactive boolean Series + column
    

    On the other hand, those slight modifications all work.

    # normal DataFrame: works
    df.loc[df['body_mass_g'] > 4000,'bill_length_mm']           # works: no interactive DataFrame
    
    # interactive DataFrame: variations that work
    dfi.loc[[10,11,12],'bill_length_mm']                        # works: list + column
    dfi.loc[dfi['body_mass_g'] > 4000]                          # works: interactive boolean Series
    dfi.loc[df['body_mass_g'] > 4000,'bill_length_mm']          # works: normal boolean Series + column
    dfi.loc[dfi['body_mass_g'] > 4000]['bill_length_mm']        # works: interactive boolean Series, column selected on output
    

    Traceback

    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    Input In [33], in <cell line: 8>()
          4 df.loc[df['body_mass_g'] > 4000,'bill_length_mm']
          6 dfi = df.interactive()
    ----> 8 dfi.loc[dfi['body_mass_g'] > 4000,'bill_length_mm']
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/hvplot/interactive.py:634, in Interactive.__getitem__(self, other)
        632 def __getitem__(self, other):
        633     other = other._transform if isinstance(other, Interactive) else other
    --> 634     return self._apply_operator(operator.getitem, other)
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/hvplot/interactive.py:521, in Interactive._apply_operator(self, operator, reverse, *args, **kwargs)
        519 transform = new._transform
        520 transform = type(transform)(transform, operator, *args, reverse=reverse)
    --> 521 return new._clone(transform)
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/hvplot/interactive.py:370, in Interactive._clone(self, transform, plot, loc, center, dmap, copy, max_rows, **kwargs)
        368 else:
        369     kwargs = dict(self._inherit_kwargs, **dict(self._kwargs, **kwargs))
    --> 370 return type(self)(self._obj, fn=self._fn, transform=transform, plot=plot, depth=depth,
        371                  loc=loc, center=center, dmap=dmap, _shared_obj=self._shared_obj,
        372                  max_rows=max_rows, **kwargs)
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/hvplot/interactive.py:276, in Interactive.__init__(self, obj, transform, fn, plot, depth, loc, center, dmap, inherit_kwargs, max_rows, method, _shared_obj, _current, **kwargs)
        274     self._current = _current
        275 else:
    --> 276     self._current = self._transform.apply(ds, keep_index=True, compute=False)
        277 self._init = True
        278 self.hvplot = _hvplot(self)
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/holoviews/util/transform.py:773, in dim.apply(self, dataset, flat, expanded, ranges, all_values, keep_index, compute, strict)
        771     drange = ranges.get(eldim, {})
        772     drange = drange.get('combined', drange)
    --> 773     data = self._apply_fn(dataset, data, fn, fn_name, args,
        774                           kwargs, accessor, drange)
        775 drop_index = keep_index_for_compute and not keep_index
        776 compute = not compute_for_compute and compute
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/holoviews/util/transform.py:673, in dim._apply_fn(self, dataset, data, fn, fn_name, args, kwargs, accessor, drange)
        671                 raise e
        672 else:
    --> 673     data = fn(*args, **kwargs)
        675 return data
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/pandas/core/indexing.py:1065, in _LocationIndexer.__getitem__(self, key)
       1063 if type(key) is tuple:
       1064     key = tuple(list(x) if is_iterator(x) else x for x in key)
    -> 1065     key = tuple(com.apply_if_callable(x, self.obj) for x in key)
       1066     if self._is_scalar_access(key):
       1067         return self.obj._get_value(*key, takeable=self._takeable)
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/pandas/core/indexing.py:1065, in <genexpr>(.0)
       1063 if type(key) is tuple:
       1064     key = tuple(list(x) if is_iterator(x) else x for x in key)
    -> 1065     key = tuple(com.apply_if_callable(x, self.obj) for x in key)
       1066     if self._is_scalar_access(key):
       1067         return self.obj._get_value(*key, takeable=self._takeable)
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/pandas/core/common.py:364, in apply_if_callable(maybe_callable, obj, **kwargs)
        353 """
        354 Evaluate possibly callable input using obj and kwargs if it is callable,
        355 otherwise return as it is.
       (...)
        361 **kwargs
        362 """
        363 if callable(maybe_callable):
    --> 364     return maybe_callable(obj, **kwargs)
        366 return maybe_callable
    
    File ~/Dropbox/Berry-Vaziri-Collaboration/.venv/lib/python3.9/site-packages/hvplot/interactive.py:490, in Interactive.__call__(self, *args, **kwargs)
        488         return self._clone(*args, **kwargs)
        489     # TODO: When is this error raised?
    --> 490     raise AttributeError
        491 elif self._method == 'plot':
        492     # This - {ax: get_ax} - is passed as kwargs to the plot method in
        493     # the dim expression.
        494     kwargs['ax'] = self._get_ax_fn()
    
    AttributeError: 
    
    opened by JanHomann 1
  • Improve the developer guide

    Improve the developer guide

    We should have a developer guide that:

    • is easy to approach
    • we trust, i.e. we should make sure that it works
    • allows users to test hvPlot and to build its site. Let's keep building packages aside for now, as contributors are less likely to do that
    type: docs 
    opened by maximlt 0
  • Gallery: make better thumbnails and host them

    Gallery: make better thumbnails and host them

    The thumbnails in the gallery are mostly generated on the fly by nbsite. While this is useful to make sure they are in sync with the notebook output and it's somewhat easier to maintain, this has a few drawbacks:

    • thumbnails should be crafted with care to make the gallery prettier (e.g. they should be squarish)
    • it makes the docs build slower
    • it makes the docs build more difficult to set up as you need some browser extension to save Bokeh figures

    So let's make some nice thumbnails. When they're built, they'll need to be hosted on S3 as done by e.g. Panel for nbsite to fetch them when it builds the site.

    nbsite_gallery_conf = {
        ....
        'thumbnail_url': 'https://assets.holoviews.org/panel/thumbnails',
        ...
    }
    
    type: docs 
    opened by maximlt 0
  • improve the hist reference guide

    improve the hist reference guide

    Closes #998.

    Please note https://github.com/holoviz/holoviews/pull/5540 closes the issue about the non-understandable error message when trying to hist categorical data.

    In addition, I've added more examples to illustrate what is possible.

    Comparing to the plotly documentation there is still a long, long way to go https://plotly.com/python/histograms/.

    opened by MarcSkovMadsen 0
  • Cannot create plotly histogram from datetime data

    Cannot create plotly histogram from datetime data

    hvplot==0.8.2

    Motivated by #998 I'm trying to improve the hist reference guide.

    When I try to create a hist plot from a datetime column it works fine as long as I use the matplotlib or bokeh backends. When I start using the plotly backend it raises an exception.

    import pandas as pd
    from bokeh.sampledata.commits import data
    import hvplot.pandas
    backend = "plotly"
    hvplot.extension(backend)
    
    data=data.reset_index().sort_values("datetime")
    plot = data.hvplot.hist(
        "datetime",
        bin_range=(pd.Timestamp('2012-11-30'), pd.Timestamp('2017-05-01')),
        bins=54, 
    )
    
    import holoviews as hv
    hv.render(plot, backend)
    
    $ python script.py
    Traceback (most recent call last):
      File "C:\repos\private\tmp\holoviews\script.py", line 15, in <module>
        hv.render(plot, backend)
      File "C:\repos\private\tmp\holoviews\holoviews\util\__init__.py", line 829, in render
        return renderer_obj.get_plot_state(obj)
      File "C:\repos\private\tmp\holoviews\holoviews\plotting\plotly\renderer.py", line 86, in get_plot_state
        fig_dict = go.Figure(fig_dict).to_dict()
      File "C:\repos\private\hvplot\.venv\lib\site-packages\plotly\graph_objs\_figure.py", line 616, in __init__
        super(Figure, self).__init__(data, layout, frames, skip_invalid, **kwargs)
      File "C:\repos\private\hvplot\.venv\lib\site-packages\plotly\basedatatypes.py", line 514, in __init__
        data = self._data_validator.validate_coerce(
      File "C:\repos\private\hvplot\.venv\lib\site-packages\_plotly_utils\basevalidators.py", line 2668, in validate_coerce
        trace = self.get_trace_class(trace_type)(
      File "C:\repos\private\hvplot\.venv\lib\site-packages\plotly\graph_objs\_bar.py", line 3199, in __init__
        self["width"] = _v
      File "C:\repos\private\hvplot\.venv\lib\site-packages\plotly\basedatatypes.py", line 4859, in __setitem__
        self._set_prop(prop, value)
      File "C:\repos\private\hvplot\.venv\lib\site-packages\plotly\basedatatypes.py", line 5198, in _set_prop
        val = validator.validate_coerce(val)
      File "C:\repos\private\hvplot\.venv\lib\site-packages\_plotly_utils\basevalidators.py", line 803, in validate_coerce
        if not (self.min_val <= v <= self.max_val):
    TypeError: The DType <class 'numpy.dtype[timedelta64]'> could not be promoted by <class 'numpy.dtype[float64]'>. This means that no common DType exists for the given inputs. For example they cannot be stored 
    in a single array unless the dtype is `object`. The full list of DTypes is: (<class 'numpy.dtype[timedelta64]'>, <class 'numpy.dtype[float64]'>)
    
    TRIAGE 
    opened by MarcSkovMadsen 0
  • Make it possible to create hist plots of time data

    Make it possible to create hist plots of time data

    Motivated by #998 I'm trying to improve the hist reference guide. As its not very clear which types of data is supported I'm trying to add an example of creating a hist plot from time data. But this seems not possible.

    Please support this

    import pandas as pd
    from bokeh.sampledata.commits import data
    
    data=data.reset_index().sort_values("datetime")
    data["time"] = pd.to_datetime(data['time'],format= '%H:%M:%S' ).dt.time
    data.hvplot.hist("time")
    
    Traceback (most recent call last):
      File "C:\repos\private\hvplot\.venv\lib\site-packages\IPython\core\interactiveshell.py", line 3433, in run_code
        exec(code_obj, self.user_global_ns, self.user_ns)
      File "C:\Users\masma\AppData\Local\Temp\ipykernel_40112\2449246375.py", line 1, in <module>
        data.hvplot.hist("time")
      File "c:\repos\private\hvplot\hvplot\plotting\core.py", line 1324, in hist
        return self(kind="hist", x=None, y=y, by=by, **kwds)
      File "c:\repos\private\hvplot\hvplot\plotting\core.py", line 92, in __call__
        return self._get_converter(x, y, kind, **kwds)(kind, x, y)
      File "c:\repos\private\hvplot\hvplot\converter.py", line 1240, in __call__
        obj = method(x, y)
      File "c:\repos\private\hvplot\hvplot\converter.py", line 1820, in hist
        hists = histogram(ds, dimension=y, **hist_opts)
      File "C:\repos\private\hvplot\.venv\lib\site-packages\param\parameterized.py", line 3654, in __new__
        return inst.__call__(*args,**params)
      File "c:\repos\private\tmp\holoviews\holoviews\core\operation.py", line 220, in __call__
        return element.apply(self, **kwargs)
      File "c:\repos\private\tmp\holoviews\holoviews\core\accessors.py", line 45, in pipelined_call
        result = __call__(*args, **kwargs)
      File "c:\repos\private\tmp\holoviews\holoviews\core\accessors.py", line 202, in __call__
        new_obj = apply_function(self._obj, **inner_kwargs)
      File "c:\repos\private\tmp\holoviews\holoviews\core\operation.py", line 214, in __call__
        return self._apply(element)
      File "c:\repos\private\tmp\holoviews\holoviews\core\operation.py", line 141, in _apply
        ret = self._process(element, key)
      File "c:\repos\private\tmp\holoviews\holoviews\operation\element.py", line 726, in _process
        data = data.astype('datetime64[ns]').astype('int64')
    ValueError: Could not convert object to NumPy datetime
    
    TRIAGE 
    opened by MarcSkovMadsen 0
Releases(v0.8.2)
  • v0.8.2(Nov 24, 2022)

    November 24, 2022

    The 0.8.2 release brings a number of bugfixes and documentation improvements. @MarcSkovMadsen has kept improving the docstrings and we congratulate @sophiamyang for her first contribution that made the landing page nicer! Many thanks to @droumis, @Hoxbro, @maximlt, @philippjfr and @MarcSkovMadsen for contributing!

    Please note that hvPlot is not yet compatible with Bokeh 3.

    • Dependencies:
      • Add Panel lower pin to ensure Bokeh 3 is not installed (#974)
    • Interactive:
      • Support slice (#776)
    • Plot:
      • Convert DataFrame columns with type RangeIndex to strings to ensure compatibility with HoloViews (#932)
      • Ensure that xarray dataset metadata propagates to NdOverlays (#930)
      • Support rioxarray (#905)
      • Improve error message mentionning pyproj (#950)
    • Explorer:
      • Don't error on datetime-like axis (#968)
      • Don't use xlim/ylim slider if start and end values are identical (#966)
    • Documentation:
      • New and updated docstrings (#892, #863)
      • Improve the landing page (#874, #903, #876)
      • Change http to https (#873)
      • Add intended rolling_window param into pipeline (#944)
      • Updates the README (#817)
      • Miscellaneous documentation improvements (#866, #887, #910)
    • Development:
      • Add pre-commit to format and lint the code on commits (#967)
    • CI:
    Source code(tar.gz)
    Source code(zip)
  • v0.8.1(Aug 28, 2022)

    August 26, 2022

    The 0.8.1 release is a bug fix release, focusing mostly on improving .interactive and the explorer. The documentation has seen some improvements too; @MarcSkovMadsen has been improving the docstrings so make sure to check them out. Many thanks to @jlstevens, @Hoxbro, @maximlt, @philippjfr and @MarcSkovMadsen for contributing!

    • Interactive:
      • Set interactive function to lazy to avoid calling it twice (772)
      • Add support for hvplot kind accessor (781, 858)
      • Add more tests to Interactive and some comments (812)
      • Fixes to the operators implemented by Interactive (814)
      • Propagate max_rows (815)
      • Only register the function parameters watchers once (818)
      • Do not re-execute transform on copied clones (833)
      • Internal callback made dependent only when parameters are found (857)
    • Explorer:
      • Make the explorer easier to use (799)
      • Enhancement to Fields tab in explorer (811)
      • Remove the marker styling option of the explorer (809)
    • Plot:
      • Make rescale_discrete_levels a plot option (758)
      • Ensure that dataframes with multiple columns are categorically shaded (759)
      • Display a color bar when rasterize is enabled (782)
      • Update the expected DataSet plot title after xarray 2022.6.0 (795)
      • Set categorically shaded when there's more than one variable (843)
      • Clone GeoViews' features (850)
    • Documentation:
      • Add new and improve existing docstrings (793, 826, 827, 822)
      • Update developer install instructions (794)
      • Rework the landing page and add a Getting started guide (838)
    • Misc:
      • No longer use basestring from holoviews.core.util (757)
      • Ensure that repr is initialized on hvplot backend import (774)
      • Add RGB test data (779)
      • Add flatten utility function (798)
    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(May 9, 2022)

    The 0.8.0 release is a minor release with some exciting new features and a large number of bug fixes and enhancements. Many thanks to @FabianHofmann, @jomey, @ablythed, @jlstevens, @Hoxbro, @michaelaye, @MridulS, @ppwadhwa, @maximlt, @philippjfr for contributing!

    Main new features:

    • Add ability to call interactive on bound functions (#720)
    • Add support to the Matplotlib and Plotly backends (#653)
    • Add the hvPlotExplorer, a Panel UI component designed to explore data (#638, #639, #651, #710, #726)

    Enhancements:

    • Interactive:
      • Allow using getitem on an accessor in interactive (#633)
      • Allow attribute access on ufunc on interactive (#635)
      • Enhancements for interactive API (#640)
      • Flatten op_args to be able to find nested widgets (#699)
    • Allow dynspread to be used with rasterize (#637)
    • Add a title to xarray plots with scalar coords (#659)
    • Adding datashade and rasterize options to scatter_matrix (#495)
    • Update the default internal value of clim to support Matplotlib (#679)
    • Ensure bokeh/panel extension is loaded only once (#686)
    • Add support for planar layout from Networkx (#700)
    • Wrap color in hv.dim when it matches a dimension/column (#717)
    • Expose datashader line_width and rescale_discrete_levels options (#731)
    • Improve array-like handling for x and y inputs (#714)

    Fixes:

    • Interactive:
      • Interactive fixes (#630)
      • Fix for interactive transform (#632)
      • Fix issue with accessors on interactive (#641)
      • Consistently dereference attribute access (#642)
    • State that the data cannot be symmetric if it's empty (#680)
    • Disable hover on errorbars plot (#721)
    • Fix application of the scale argument for geoviews features (#725)

    Documentation:

    • Add scatter matrix reference (#689)
    • Plotting user guide enhancement (#694)
    • Download a tutorial file with the right filename (#711)
    • Add more imports to try/except import check (#693)
    • Various minor documentation enhancements and fixes (#625, #643, #644, #663, #678, #722)

    Maintenance:

    • Drop support for py2.7, min supported version is py3.6 now (#702)
    • Switch to Pytest and run the CI on Python 3.6, 3.8 and 3.9 (#703)
    • Changed to packaging.version (#708)
    • Fix a broken test due to PROJ unexpectedly matching a normal string (#660)
    • Various improvements to the CI (#690, #691. #709, #712, #715, #719, #724, #727, #730, #732, #733, #734, #735)
    Source code(tar.gz)
    Source code(zip)
  • v0.7.3(Jul 26, 2021)

    This is a minor release focusing on greatly improving the .interactive() API for flexibly building simple apps using widget controls. Thanks to @jbednar and @jlstevens for a few small fixes and many thanks to @philippjfr for all the rest!

    Features:

    • Improved .interactive Dataframe support: max_rows display, column access (#640)
    • Improved accessor and attribute behavior for .interactive (#633, #635, #641, #642)
    • Add .holoviews() terminal method to .interactive pipelines
    • Add support for kwargs to .interactive.layout
    • Misc fixes to .interactive API (#630, #632)
    • Allow dynspread=True to be used with rasterize=True (now that Datashader supports it)
    Source code(tar.gz)
    Source code(zip)
  • v0.7.2(May 23, 2021)

    This is a minor release with a number of bug fixes and enhancements. Many thanks to @StefanBrand, @loicduffar, @brl0, @michaelaye, @aaronspring, @toddrjen, @raybellwaves, @jlstevens, @jbednar and @philippjfr for contributing.

    Features:

    • Add support for geographic features (#622)
    • Added support for OHLC plot (#623)

    Enhancements:

    • Support setting options for diagonal plots in scatter_matrix (#602)
    • Take group_label from columns if available (#615)
    • Add kwargs to interactive.layout()

    Bug fixes:

    • Fix support for clim on contours (#587)
    • Adding default coordinates to datasets with missing coords (#605)
    • Do not plot streamz example point (#614)
    • Fix passing in multiple z-values (#616)
    • Ensure violin and boxplot color is applied (#619)
    • Ensure categorical colormapping is applied during datashade (#621)

    Compatibility:

    • Switch default tile source to OSM (since Wikipedia tiles are no longer available) (#610)

    Documentation:

    • Correctly document .hist rather than .histogram (#571)
    • Use strings rather than bytes when referring to airplane dataset columns (#538)
    • Preserve function signature and docstring in with_hv_extension (#601)
    • Add hover_cols example (#612)
    • Switch to pydata sphinx theme (#613)
    • Update available options in customization docs (#620)
    Source code(tar.gz)
    Source code(zip)
  • v0.7.1(Mar 4, 2021)

    Major new features:

    • Add Ibis backend, providing hvPlot features for lazy SQL queries (#507)

    Bugfixes and minor updates:

    • Add hover='vline' hover='hline' options to expose Bokeh HoverTool mode (#493)
    • Support streaming plots from HoloViews streams (not needing a streamz source) (#542)
    • Misc: GitHub Actions (#568), melting wide data (#566), 'by' columns (#565), NetworkX (#549), cycles for continuous colormaps (#548), interactivity warning (#550)
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Dec 16, 2020)

    Thanks to @philippjfr for managing this release and implementing most of the features, and to @jbednar, @ahuang11, and @AurelienSciarra for contributions.

    Major new features:

    • Powerful new .interactive() API for building easy apps (#505, #523)
    • New transforms argument to transform data in .hvplot() calls (#526)

    Other new features and enhancements:

    • Support passing geographic projections as strings (#372)
    • Improved data selection, e.g. for filtering on metadata (#522)
    • Provide color_key to datashade as well as cmap, for convenience (#525)
    • Update param warnings to new API (#528)
    • Replace TravisCI tests with GitHub Actions (#524)

    Bug fixes:

    • Fix for specifying hover_cols (#504)
    • Remove outdated reference to __main__ console script (#494)
    • Misc doc fixes, including to Streaming.ipynb (#481, #511)
    • Handle node_shape for networkx (#527)
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Jun 2, 2020)

    This release includes major contributions from @philippjfr (overall maintenance and bugfixes) and @jsignell (reference gallery), plus additional contributions from @slamer59 (environment), @anitagraser (examples), @itcarroll (color_key alias), @Timothy-W-Hilton (bugfix), @jbednar (bugfix), @SandervandenOord (fontscale), and @jordansamuels (doc fixes).

    New features:

    • Added (a start to) a reference gallery (#302, #357, #359, #360, #361)
    • Improved save and show utilities (#451)
    • Improved compatibility for tab completion (#411)
    • Major performance enhancement with Datashader in some cases (#465)
    • Add support for cuDF (#454, #466)
    • Support by argument for categorical aggregation (#461)
    • Support color_key alias (#446, #458)
    • Support spatialpandas for large sets of polygons (#459)
    • Add fontscale keyword (#397)
    • Added heat and trees example to topics (#378)

    Bug fixes and compatibility:

    • Fixed 'title_format' deprecation warning (#428)
    • Fix networkx documentation (#476)
    • Avoid sorting overlays, to make color cycles consistent (#475)
    • Replaced sphinx_pyviz_theme with sphinx_holoviz_theme (#366)
    • Removed references to pyviz (#373)
    • Update environment.yml (#356)
    • Misc bugfixes/updates (#387, #403, #408, #439, #447, #448, #449, #450, #452, #453, #456, #467)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.2(Feb 3, 2020)

    This release mostly includes contributions from @jsignell.

    • Allow tile sources to be objects as well as strings (#345)
    • Set geo=True by default for coastline (#344)
    • Add check_symmetric_max limit for working with large data (#340)
    • Expose plot at top level, to support pd.options.plotting.backend = 'hvplot' (#347)
    • Misc bug fixes (#341, #343, #346)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(May 27, 2020)

  • v0.5.0(Oct 17, 2019)

    This is a major release that includes bug fixes, changes to default behavior, and enhancements.

    Features:

    • Widget handling capabilities to facilitate interactivity (#323, #331)
    • New default colormaps (#258, #316, #206)
    • long_name(units) used to label xarray objects (#173)
    • Derived datetime accessor handlind ( #263, #286)
    • coastline and tiles options for easy geo plots.
    • Automatic date sorting (#259)
    • Allow use of strings as aggregators for datashader (#257)

    For a full list of changes see: https://github.com/pyviz/hvplot/compare/v0.4.0...v0.5.0

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Feb 4, 2019)

    This is a major release which includes the addition of a networkx plotting API and a number of important bug fixes.

    Features:

    • A new NetworkX interface providing equivalents for the networkx plotting module (#152, #154)

    Fixes:

    • Fixed handling of labelled property to hide axis labels (#142)
    • Fixed handling of DataArrays and groupby on RGB plots (#138, #141)
    • Allow setting axis position (#149)
    • Fixes for setting the axis positions (#145)
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jan 7, 2019)

    This release includes a number of major improvements to the documentation and core functionality as well as a variety of bug fixes.

    • Added improved docstrings including all available options (https://github.com/pyviz/hvplot/pull/103, https://github.com/pyviz/hvplot/pull/134)
    • Added support for tab-completion in interactive environments such as IPython and Jupyter notebooks (https://github.com/pyviz/hvplot/pull/134)
    • Added support for rgb (https://github.com/pyviz/hvplot/pull/137) and labels (https://github.com/pyviz/hvplot/pull/98) plot types
    • Exposed bokeh styling options for all plot types (https://github.com/pyviz/hvplot/pull/134)
    • Compatibility with latest HoloViews/GeoViews releases (https://github.com/pyviz/hvplot/pull/113, https://github.com/pyviz/hvplot/pull/118, https://github.com/pyviz/hvplot/pull/134)
    • Added control over tools (https://github.com/pyviz/hvplot/pull/120) and legend position (https://github.com/pyviz/hvplot/pull/119)
    Source code(tar.gz)
    Source code(zip)
Owner
HoloViz
High-level tools to simplify visualization in Python
HoloViz
Turn a STAC catalog into a dask-based xarray

StackSTAC Turn a list of STAC items into a 4D xarray DataArray (dims: time, band, y, x), including reprojection to a common grid. The array is a lazy

Gabe Joseph 148 Dec 19, 2022
Bokeh Plotting Backend for Pandas and GeoPandas

Pandas-Bokeh provides a Bokeh plotting backend for Pandas, GeoPandas and Pyspark DataFrames, similar to the already existing Visualization feature of

Patrik Hlobil 822 Jan 7, 2023
Bokeh Plotting Backend for Pandas and GeoPandas

Pandas-Bokeh provides a Bokeh plotting backend for Pandas, GeoPandas and Pyspark DataFrames, similar to the already existing Visualization feature of

Patrik Hlobil 614 Feb 17, 2021
Interactive plotting for Pandas using Vega-Lite

pdvega: Vega-Lite plotting for Pandas Dataframes pdvega is a library that allows you to quickly create interactive Vega-Lite plots from Pandas datafra

Altair 342 Oct 26, 2022
Interactive plotting for Pandas using Vega-Lite

pdvega: Vega-Lite plotting for Pandas Dataframes pdvega is a library that allows you to quickly create interactive Vega-Lite plots from Pandas datafra

Altair 340 Feb 1, 2021
With Holoviews, your data visualizes itself.

HoloViews Stop plotting your data - annotate your data and let it visualize itself. HoloViews is an open-source Python library designed to make data a

HoloViz 2.3k Jan 2, 2023
With Holoviews, your data visualizes itself.

HoloViews Stop plotting your data - annotate your data and let it visualize itself. HoloViews is an open-source Python library designed to make data a

HoloViz 1.8k Feb 17, 2021
With Holoviews, your data visualizes itself.

HoloViews Stop plotting your data - annotate your data and let it visualize itself. HoloViews is an open-source Python library designed to make data a

HoloViz 2.3k Jan 4, 2023
Generate graphs with NetworkX, natively visualize with D3.js and pywebview

webview_d3 This is some PoC code to render graphs created with NetworkX natively using D3.js and pywebview. The main benifit of this approac

byt3bl33d3r 68 Aug 18, 2022
Fastest Gephi's ForceAtlas2 graph layout algorithm implemented for Python and NetworkX

ForceAtlas2 for Python A port of Gephi's Force Atlas 2 layout algorithm to Python 2 and Python 3 (with a wrapper for NetworkX and igraph). This is the

Bhargav Chippada 227 Jan 5, 2023
Draw interactive NetworkX graphs with Altair

nx_altair Draw NetworkX graphs with Altair nx_altair offers a similar draw API to NetworkX but returns Altair Charts instead. If you'd like to contrib

Zachary Sailer 206 Dec 12, 2022
Draw interactive NetworkX graphs with Altair

nx_altair Draw NetworkX graphs with Altair nx_altair offers a similar draw API to NetworkX but returns Altair Charts instead. If you'd like to contrib

Zachary Sailer 156 Feb 6, 2021
By default, networkx has problems with drawing self-loops in graphs.

By default, networkx has problems with drawing self-loops in graphs. It makes it hard to draw a graph with self-loops or to make a nicely looking chord diagram. This repository provides some code to draw self-loops nicely

Vladimir Shitov 5 Jan 6, 2022
MPL Plotter is a Matplotlib based Python plotting library built with the goal of delivering publication-quality plots concisely.

MPL Plotter is a Matplotlib based Python plotting library built with the goal of delivering publication-quality plots concisely.

Antonio López Rivera 162 Nov 11, 2022
A TileDB backend for xarray.

TileDB-xarray This library provides a backend engine to xarray using the TileDB Storage Engine. Example usage: import xarray as xr dataset = xr.open_d

TileDB, Inc. 14 Jun 2, 2021
High-level geospatial data visualization library for Python.

geoplot: geospatial data visualization geoplot is a high-level Python geospatial plotting library. It's an extension to cartopy and matplotlib which m

Aleksey Bilogur 1k Jan 1, 2023
Python scripts for plotting audiograms and related data from Interacoustics Equinox audiometer and Otoaccess software.

audiometry Python scripts for plotting audiograms and related data from Interacoustics Equinox 2.0 audiometer and Otoaccess software. Maybe similar sc

Hamilton Lab at UT Austin 2 Jun 15, 2022
Analysis and plotting for motor/prop/ESC characterization, thrust vs RPM and torque vs thrust

esc_test This is a Python package used to plot and analyze data collected for the purpose of characterizing a particular propeller, motor, and ESC con

Alex Spitzer 1 Dec 28, 2021
3D plotting and mesh analysis through a streamlined interface for the Visualization Toolkit (VTK)

PyVista Deployment Build Status Metrics Citation License Community 3D plotting and mesh analysis through a streamlined interface for the Visualization

PyVista 1.6k Jan 8, 2023