# Does HvPlot support Plotly for interactive dataframes?

**URL:** <https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915>\
**Category:** hvPlot\
**Tags:** plotly\
**Created:** [July 7, 2022, 8:26pm UTC](https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915 "2022-07-07T20:26:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hollowheights](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/hollowheights/32/3684_2.png) [@hollowheights](https://discourse.holoviz.org/u/hollowheights)\
**Post date:** [July 7, 2022, 8:26pm UTC](https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915/1 "2022-07-07T20:26:56Z")

</div>

I usually use Plotly and therefore would prefer to stick to that. But being new to HvPlot I run into obstacles when I try to plot with the setting: hvplot.extension(‘plotly’)

For instance when I try to do:

> ifig = ipipeline.hvplot.hist(x=“Date”)

I get the error: AttributeError: ‘function’ object has no attribute ‘hist’  
The hist function/method is described here: [Plotting with Plotly — hvPlot 0.9.0 documentation](https://hvplot.holoviz.org/user_guide/Plotting_with_Plotly.html#histogram)

Could this be because HvPlot only supports Plotly for static data?

---

<div class="post-metadata">

**Author:** ![ea42gh](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/ea42gh/32/73_2.png) [@ea42gh](https://discourse.holoviz.org/u/ea42gh)\
**Post date:** [July 8, 2022, 4:15am UTC](https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915/2 "2022-07-08T04:15:41Z")

</div>

@hollowheights welcome to discourse!

Could you please supply a short executable piece of code  
exhibiting your problem? It will be much easier to help you  
when you do.

---

<div class="post-metadata">

**Author:** ![hollowheights](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/hollowheights/32/3684_2.png) [@hollowheights](https://discourse.holoviz.org/u/hollowheights)\
**Post date:** [July 8, 2022, 10:15pm UTC](https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915/3 "2022-07-08T22:15:15Z")

</div>

Hi @ea42gh  
I have updated my post now, hope that makes it clearer.

It’s possible I have overlooked something simple, but I am already many hours into trying to use Plotly for Hvplot and can’t even make these rather simple things work - so hoping for someone to clear up a few things for me.

UPDATE  
It seems I was blocked from applying the changes. They were showing in my browser as, but only until updating the page.

Here is the updated post:

I usually use Plotly and therefore would prefer to stick to that. But being new to HvPlot I run into obstacles when I try to plot with the setting: hvplot.extension(‘plotly’)

For instance when I try to do:

```auto
from bokeh.sampledata.autompg import autompg_clean as df
import hvplot.pandas
import panel as pn
import holoviews as hv
hv.extension('plotly')
pn.extension('tabulator')
PALETTE = ["#ff6f69", "#ffcc5c", "#88d8b0",]

```

```auto
# Make DataFrame Pipeline Interactive
idf = df.interactive()

# Define Panel widgets
cylinders = pn.widgets.IntSlider(name='Cylinders', start=4, end=8, step=1)
mfr = pn.widgets.ToggleGroup(
    name='MFR',
    options=['ford', 'chevrolet', 'honda', 'toyota', 'audi'], 
    value=['ford', 'chevrolet', 'honda', 'toyota', 'audi'],
    button_type='success')
yaxis = pn.widgets.RadioButtonGroup(
    name='Y axis', 
    options=['hp', 'weight'],
    button_type='success'
)

# Combine pipeline and widgets
ipipeline = (
    idf[
        (idf.cyl == cylinders) & 
        (idf.mfr.isin(mfr))
    ]
    .groupby(['origin', 'mpg'])[yaxis].mean()
    .to_frame()
    .reset_index()
    .sort_values(by='mpg')  
    .reset_index(drop=True)
)

```

Now if I simply try to use hvplot on the dataframe it works:

```auto
ihvplot = ipipeline.hvplot()

```

However, if I try to press tab after hvplot there is nothing suggested as methods to be called (as suggested in the documentation). Similarly, if I try to specify a plot type like this:

> ihvplot = ipipeline.hvplot.hist(x=‘mpg’, y=yaxis, by=‘origin’,color=PALETTE)

or like this:  
`Preformatted text`ihvplot = idf.hvplot.hist()

I get the error: AttributeError: ‘function’ object has no attribute ‘hist’  
The hist function/method is described here: [Plotting with Plotly — hvPlot 0.9.0 documentation](https://hvplot.holoviz.org/user_guide/Plotting_with_Plotly.html#histogram)

Could this be because HvPlot only supports Plotly for static data?

---

<div class="post-metadata">

**Author:** ![Marc](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/marc/32/24_2.png) [@Marc](https://discourse.holoviz.org/u/Marc)\
**Post date:** [July 24, 2022, 5:25pm UTC](https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915/4 "2022-07-24T17:25:40Z")

</div>

Hi @hollowheights

The issue is not plotly. The issue is that when the pipeline/ dataframe is interactive `.hvplot` is a function and has no methods. I.e. `.scatter`, `.hist`, … etc. is not defined.

What you can do is use `.hvplot(....., kind="hist")` instead of `.hvplot.hist(...)`.

 ![image](https://discourse.holoviz.org/uploads/default/original/2X/a/a3f51b60293d772beee52c4e6943087622bbfc01.png)

```python
from bokeh.sampledata.autompg import autompg_clean as df
import hvplot.pandas
import panel as pn
import holoviews as hv
hv.extension('plotly')
pn.extension('tabulator')
PALETTE = ["#ff6f69", "#ffcc5c", "#88d8b0",]

# Make DataFrame Pipeline Interactive
idf = df.interactive()

# Define Panel widgets
cylinders = pn.widgets.IntSlider(name='Cylinders', start=4, end=8, step=1)
mfr = pn.widgets.ToggleGroup(
    name='MFR',
    options=['ford', 'chevrolet', 'honda', 'toyota', 'audi'], 
    value=['ford', 'chevrolet', 'honda', 'toyota', 'audi'],
    button_type='success')
yaxis = pn.widgets.RadioButtonGroup(
    name='Y axis', 
    options=['hp', 'weight'],
    button_type='success'
)

# Combine pipeline and widgets
ipipeline = (
    idf[
        (idf.cyl == cylinders) & 
        (idf.mfr.isin(mfr))
    ]
    .groupby(['origin', 'mpg'])[yaxis].mean()
    .to_frame()
)
iplot = ipipeline.hvplot(x="mpg", y=yaxis, by='origin', color=PALETTE, kind="hist", width=1000, height=500)

import panel as pn
pn.extension(sizing_mode="stretch_width", template="fast")
pn.state.template.param.update(site="Awesome Panel", title="hvPlot .interactive - DataFrame pipelines with widgets")
pn.panel(iplot).servable()

```

---

<div class="post-metadata">

**Author:** ![philippjfr](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/philippjfr/32/7_2.png) [@philippjfr](https://discourse.holoviz.org/u/philippjfr)\
**Post date:** [July 24, 2022, 5:52pm UTC](https://discourse.holoviz.org/t/does-hvplot-support-plotly-for-interactive-dataframes/3915/5 "2022-07-24T17:52:23Z")

</div>

Note that we are working on fixing this: [Add support for accessor in hvplot.interactive by Hoxbro · Pull Request #781 · holoviz/hvplot · GitHub](https://github.com/holoviz/hvplot/pull/781)
