internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: holoviz/holoviews

Issue:
Aggregate plot by time of day after doing some grouping
To explain, let me show some exemplary code:

```python
dr = pd.date_range("2020-01-01","2020-01-10",freq="min")
counts = np.random.normal(0,1,(len(dr)))
df = pd.DataFrame(index=dr, columns=["counts"])
df["counts"] = counts
df["time"] = df.index.time
df["weekday"] = df.index.dayofweek
df.loc["2020-01-02", "counts"] = df.loc["2020-01-02", "counts"] * 5

# hvplot
df.groupby(["weekday","time"])[["counts"]].mean().reset_index().hvplot(x="time", y="counts", by="weekday") # or groupby="weekday"

# matplotlib
df.groupby(["weekday","time"])[["counts"]].mean().unstack("weekday").plot()

```

Matplotlib works perfect, I think bokeh can’t handle the x-axis because time is a str after index.dt.time. I can’t find another way to do this plot in Holoviews.

Also see discussion here:
https://discourse.holoviz.org/t/aggregate-plot-by-time-of-day-after-doing-some-grouping/162



Discussion:

Resolving patch:
diff --git a/holoviews/core/util.py b/holoviews/core/util.py
--- a/holoviews/core/util.py
+++ b/holoviews/core/util.py
@@ -74,7 +74,7 @@ def __cmp__(self, other):
 numpy_version = LooseVersion(np.__version__)
 param_version = LooseVersion(param.__version__)
 
-datetime_types = (np.datetime64, dt.datetime, dt.date)
+datetime_types = (np.datetime64, dt.datetime, dt.date, dt.time)
 timedelta_types = (np.timedelta64, dt.timedelta,)
 arraylike_types = (np.ndarray,)
 
@@ -954,7 +954,7 @@ def max_range(ranges, combined=True):
         with warnings.catch_warnings():
             warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
             values = [tuple(np.NaN if v is None else v for v in r) for r in ranges]
-            if pd and any(isinstance(v, datetime_types) and not isinstance(v, cftime_types)
+            if pd and any(isinstance(v, datetime_types) and not isinstance(v, cftime_types+(dt.time,))
                           for r in values for v in r):
                 converted = []
                 for l, h in values:


Test patch:
Repository: holoviz/holoviews

Issue:
hv.save and hv.output always output html for a dynamic map
When calling `hv.save()` on a dynamic map object, holoviews ignores the `fmt` parameter as well as the file ending and always saves the output in html format with a .html file ending. `hv.output()` will also ignore the `fig` parameter.

I ran into this issue while trying to save a plot created with datashade as it generates a dynamic map object by default. 

Example:
```python
import holoviews as hv
hv.extension("bokeh")

plot = hv.DynamicMap(hv.Points(([1,2],[1,2])))

hv.save(plot, "test1.png")
hv.save(plot, "test2", fmt="png")
hv.save(plot, "test3.png", fmt="png")

hv.output(plot, fig="png")
```

The above code will create files `test1.html`, `test2.html`, and `test3.html` and an interactive output will be shown.

I would expect these calls to produce a static image of the current state of the dynamic map. If that is not possible, I think these calls should throw an error stating that png format is incompatible with a dynamic map object.

I am using holoviews 1.13.2 and python 3.7.1. It is running inside JupyterLab 1.2.6 on a Windows 10 machine.


Discussion:
Thanks your suggestions all seem sensible.

Resolving patch:
diff --git a/holoviews/plotting/renderer.py b/holoviews/plotting/renderer.py
--- a/holoviews/plotting/renderer.py
+++ b/holoviews/plotting/renderer.py
@@ -32,7 +32,7 @@
 from ..core import Layout, HoloMap, AdjointLayout, DynamicMap
 from ..core.io import Exporter
 from ..core.options import Store, StoreOptions, SkipRendering, Compositor
-from ..core.util import unbound_dimensions, LooseVersion
+from ..core.util import basestring, unbound_dimensions, LooseVersion
 from ..streams import Stream
 from . import Plot
 from .util import displayable, collate, initialize_dynamic
@@ -319,6 +319,8 @@ def html(self, obj, fmt=None, css=None, resources='CDN', **kwargs):
         """
         plot, fmt =  self._validate(obj, fmt)
         figdata, _ = self(plot, fmt, **kwargs)
+        if isinstance(resources, basestring):
+            resources = resources.lower()
         if css is None: css = self.css
 
         if isinstance(plot, Viewable):
@@ -557,6 +559,8 @@ def save(self_or_cls, obj, basename, fmt='auto', key={}, info={},
                 resources = CDN
             elif resources.lower() == 'inline':
                 resources = INLINE
+            if isinstance(basename, basestring) and fmt in MIME_TYPES:
+                basename = '.'.join([basename, fmt])
             plot.layout.save(basename, embed=True, resources=resources)
             return
 


Test patch:
Repository: holoviz/holoviews

Issue:
Confusing example on sorting columns for tabular data
The example here on Sorting by columns with Tabular data is somewhat confusing as each of the four plots look the same.

http://holoviews.org/user_guide/Tabular_Datasets.html#Sorting-by-columns


<img width="1208" alt="Screen Shot 2020-06-11 at 12 32 26 AM" src="https://user-images.githubusercontent.com/2942215/84358017-5d211e00-ab7b-11ea-95d8-b9787fdfad58.png">



Discussion:
Thanks @smsaladi, looks like a bug to me.

Resolving patch:
diff --git a/holoviews/plotting/bokeh/geometry.py b/holoviews/plotting/bokeh/geometry.py
--- a/holoviews/plotting/bokeh/geometry.py
+++ b/holoviews/plotting/bokeh/geometry.py
@@ -63,7 +63,7 @@ def get_data(self, element, ranges, style):
         y0, y1 = np.min([y0, y1], axis=0), np.max([y0, y1], axis=0)
         data = {
             'x': x0+(x1-x0)/2.,
-            'y': x0+(x1-x0)/2.,
+            'y': y0+(y1-y0)/2.,
             'width': x1-x0,
             'height': y1-y0
         }
diff --git a/holoviews/plotting/bokeh/selection.py b/holoviews/plotting/bokeh/selection.py
--- a/holoviews/plotting/bokeh/selection.py
+++ b/holoviews/plotting/bokeh/selection.py
@@ -99,5 +99,5 @@ def _style_region_element(self, region_element, unselected_color):
 
         region = region_element.opts(el1_name, clone=True, **options)
         if el2_name and el2_name == 'Path':
-            region = region.opts(el2_name, backend='bokeh', color='black')
+            region = region.opts(el2_name, backend='bokeh', color='black', line_dash='dotted')
         return region
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -95,7 +95,7 @@
     'nbsite >0.5.2',
     'sphinx',
     'sphinx_holoviz_theme',
-    'mpl_sample_data >=3.2.1',
+    'mpl_sample_data >=3.1.3',
     'awscli',
     'pscript',
     'graphviz'


Test patch:
Repository: holoviz/holoviews

Issue:
hv.extension('bokeh', inline=False) doesn't load javascript from CDN
#### ALL software version info

* Holoviews 1.13.2
* jupyterlab 2.1.0
* bokeh 2.0.1
* panel 0.9.5

#### Description of expected behavior and the observed behavior

To reduce the size of the notebooks, I use `holoviews.extension('bokeh', inline=False)`, but the size of the notebook doesn't change.

#### Complete, minimal, self-contained example code that reproduces the issue

```python
import holoviews as hv
hv.extension('bokeh', inline=False)
```

and then check the size of the notebook.

I found how to fix this:

https://github.com/holoviz/holoviews/blob/0693a07f2af1095bca84be9c9a8a2503d1ded9ab/holoviews/ipython/__init__.py#L188

change the line to `Renderer.load_nb(inline=p.inline)`.


Discussion:
Oh wow, thanks for catching that. A PR would be very welcome.

Resolving patch:
diff --git a/holoviews/ipython/__init__.py b/holoviews/ipython/__init__.py
--- a/holoviews/ipython/__init__.py
+++ b/holoviews/ipython/__init__.py
@@ -185,7 +185,7 @@ def __call__(self, *args, **params):
 
         for r in [r for r in resources if r != 'holoviews']:
             Store.renderers[r].load_nb(inline=p.inline)
-        Renderer.load_nb()
+        Renderer.load_nb(inline=p.inline)
 
         if hasattr(ip, 'kernel') and not loaded:
             Renderer.comm_manager.get_client_comm(notebook_extension._process_comm_msg,


Test patch:
Repository: holoviz/holoviews

Issue:
DynamicMap doesn't use Dimension's default value if the value is 0
Holoviews 1.13.3

Here is the code:

```python
import holoviews as hv
hv.extension('bokeh')

def f(a, b):
    x = [0, 1]
    y = [a, b]
    return hv.Curve((x, y))

dm = hv.DynamicMap(f, kdims=[
    hv.Dimension('a', range=(-3.0, 3.0), default=0.0),
    hv.Dimension('b', range=(-3.0, 3.0), default=0.0)
])

dm
```

the output plot is:

![image](https://user-images.githubusercontent.com/826871/88611635-6717c580-d0c4-11ea-81e1-8e19ebea0012.png)

the value of a and b is 0, but the y axis of the line is -3. It uses the start value of the Dimension's range.


Discussion:

Resolving patch:
diff --git a/holoviews/core/spaces.py b/holoviews/core/spaces.py
--- a/holoviews/core/spaces.py
+++ b/holoviews/core/spaces.py
@@ -951,7 +951,7 @@ def _initial_key(self):
         for kdim in self.kdims:
             if str(kdim) in stream_params:
                 key.append(None)
-            elif kdim.default:
+            elif kdim.default is not None:
                 key.append(kdim.default)
             elif kdim.values:
                 if all(util.isnumeric(v) for v in kdim.values):


Test patch:
Repository: holoviz/holoviews

Issue:
Incorrect pickle dump/load for Dimension
#### ALL software version info
Holoviews 1.14.1, Python 3.7.6

#### Description of expected behavior and the observed behavior
`hv.Dimension` does not pickle correctly. As shown in example below, dimension loaded from pickle is different than the original.

#### Complete, minimal, self-contained example code that reproduces the issue

```python
import holoviews as hv
import pickle

path = "tmp.pkl"
d = hv.Dimension('current', label='I', unit='mA')

with open(path, 'wb') as handle:
    pickle.dump(d, handle)

with open(path, 'rb') as handle:
    d_loaded = pickle.load(handle)
    
print(repr(d))
print(d.pprint_label)

print(repr(d_loaded))  # repr does not match
print(d_loaded.pprint_label)  # note that label is not used

```
result:
```
Dimension('current', label='I', unit='mA')
I (mA)
Dimension('current')
current (mA)
```
whereas I would expect to see:
```
Dimension('current', label='I', unit='mA')
I (mA)
Dimension('current', label='I', unit='mA')
I (mA)
```




Discussion:
Thanks for reporting this!

`Dimension` objects should definitely pickle correctly so I consider this a relatively high priority bug.

Resolving patch:
diff --git a/holoviews/core/dimension.py b/holoviews/core/dimension.py
--- a/holoviews/core/dimension.py
+++ b/holoviews/core/dimension.py
@@ -353,7 +353,8 @@ def __setstate__(self, d):
         Compatibility for pickles before alias attribute was introduced.
         """
         super(Dimension, self).__setstate__(d)
-        self.label = self.name
+        if '_label_param_value' not in d:
+            self.label = self.name
 
     def __eq__(self, other):
         "Implements equals operator including sanitized comparison."


Test patch:
Repository: holoviz/holoviews

Issue:
`hv.dim` doesn't support multiple parametrized inputs per operation
If you try to have more than one parametrized input per deferred `hv.dim` operation, one of the widgets doesn't update.
This is because `hv.dim.params` overwrites keys in the returned dictionary for more than one input, causing the problem seen in holoviz/hvplot#593 (see there for a MRE).

Looking at the source for the `params` accessor:
```
@property
def params(self):
    params = {}
    for op in self.ops:
        op_args = list(op['args'])+list(op['kwargs'].values())
        for op_arg in op_args:
            ...
            if (isinstance(op_arg, param.Parameter) and
                isinstance(op_arg.owner, param.Parameterized)):
                  params[op_arg.name+str(id(op))] = op_arg      
    return params
```
All dictionary keys of `params` must be unique; to ensure this, `str(id(op))` is part of the key.
However, if one `op` maps to multiple `op_arg`s, then this no longer holds.
Changing it to `str(id(op_arg))` fixes holoviz/hvplot#593.


#### ALL software version info
`holoviews 1.14.2`
`hvplot 0.7.1`





Discussion:

Resolving patch:
diff --git a/holoviews/util/transform.py b/holoviews/util/transform.py
--- a/holoviews/util/transform.py
+++ b/holoviews/util/transform.py
@@ -322,7 +322,7 @@ def params(self):
                     params.update(op_arg.params)
                 if (isinstance(op_arg, param.Parameter) and
                     isinstance(op_arg.owner, param.Parameterized)):
-                    params[op_arg.name+str(id(op))] = op_arg
+                    params[op_arg.name+str(id(op_arg))] = op_arg
                 
         return params
 


Test patch:
Repository: holoviz/holoviews

Issue:
Empty Violin plot with the Matplotlib backend
The following snippet renders an empty plot with the **Matplotlib** backend while it's correctly rendering a Violin plot with the Bokeh one.
```python
import holoviews as hv
from hvplot.sample_data import airline_flights

hv.extension('matplotlib')

flights = airline_flights.read()
ds = hv.Dataset(flights, kdims=['carrier'], vdims=['depdelay'])
hv.Violin(ds)
```
<img width="315" alt="image" src="https://user-images.githubusercontent.com/35924738/141213487-c70123a3-7a5f-43ec-bef6-298c566e7289.png">

This warning is also displayed:
```
/Users/mliquet/miniconda3/envs/hvplot-dev37/lib/python3.7/site-packages/numpy/linalg/linalg.py:2159: RuntimeWarning: invalid value encountered in det
  r = _umath_linalg.det(a, signature=signature)
```


Discussion:

Resolving patch:
diff --git a/holoviews/plotting/mpl/stats.py b/holoviews/plotting/mpl/stats.py
--- a/holoviews/plotting/mpl/stats.py
+++ b/holoviews/plotting/mpl/stats.py
@@ -197,7 +197,8 @@ def get_data(self, element, ranges, style):
                 label = ','.join([d.pprint_value(v) for d, v in zip(element.kdims, key)])
             else:
                 label = key
-            data.append(group[group.vdims[0]])
+            d = group[group.vdims[0]]
+            data.append(d[np.isfinite(d)])
             labels.append(label)
             colors.append(elstyle[i].get('facecolors', 'blue'))
         style['positions'] = list(range(len(data)))
@@ -208,6 +209,7 @@ def get_data(self, element, ranges, style):
             element = element.aggregate(function=np.mean)
         else:
             element = element.clone([(element.aggregate(function=np.mean),)])
+
         new_style = self._apply_transforms(element, ranges, style)
         style = {k: v for k, v in new_style.items()
                  if k not in ['zorder', 'label']}


Test patch:
Repository: holoviz/holoviews

Issue:
Make hv.Cycle KeyError text more helpful or read keys for hv.Cycle automatically
Using: Holoviews 1.14.8

#### Is your feature request related to a problem? Please describe.
When following some examples from the internet, there might be a point where `hv.Cycle` is used. Usage of it needs import with side effects. Without any imports, user will see:

```python
In [1]: import holoviews as hv
   ...: hv.Cycle("Set1")
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Input In [1], in <module>
      1 import holoviews as hv
----> 2 hv.Cycle("Set1")

File c:\python\venvs\myproj\lib\site-packages\holoviews\core\options.py:325, in Cycle.__init__(self, cycle, **params)
    323         params['key'] = None
    324 super(Cycle, self).__init__(**params)
--> 325 self.values = self._get_values()

File c:\python\venvs\myproj\lib\site-packages\holoviews\core\options.py:335, in Cycle._get_values(self)
    333 if self.values: return self.values
    334 elif self.key:
--> 335     return list(self.default_cycles[self.key])
    336 else:
    337     raise ValueError("Supply either a key or explicit values.")

KeyError: 'Set1'
```

While the following works (as calling `hv.extension` has a side effect that is needed for `hv.Cycle`):

```python
In [1]: import holoviews as hv
   ...: hv.extension()
   ...:
   ...: hv.Cycle("Set1")
Out[1]: Cycle('Set1')
```

#### Describe the solution you'd like

Instead of printing 

```
KeyError: 'Set1'
```

print 

```
KeyError: 'Set1'. Did you forget to call panel.extension?
```

#### Describe alternatives you've considered

Another possibility could be to call  `hv.extension`, or somehow else fetch the default list of keys for `hv.Cycle`, in case of error.

---
*Edit*: replaced `pn.extension` with `hv.extension`.


Discussion:

Resolving patch:
diff --git a/holoviews/core/options.py b/holoviews/core/options.py
--- a/holoviews/core/options.py
+++ b/holoviews/core/options.py
@@ -331,8 +331,16 @@ def __getitem__(self, num):
 
     def _get_values(self):
         if self.values: return self.values
-        elif self.key:
+        elif self.key and self.key in self.default_cycles:
             return list(self.default_cycles[self.key])
+        elif self.key:
+            current = Store.current_backend
+            others = " or ".join({"matplotlib", "bokeh", "plotly"} - {current})
+            raise ValueError(
+                "The key you have supplied is not available "
+                f"for the {current} backend. Try to switch to {others} "
+                "with 'hv.extension(backend)'."
+            )
         else:
             raise ValueError("Supply either a key or explicit values.")
 


Test patch:
Repository: holoviz/holoviews

Issue:
Multiple display calls of vectorfield changes its own magnitude data
# ALL software version info

```
hv version '1.14.9'

        
IPython          : 8.2.0
        ipykernel        : 6.13.0
        ipywidgets       : 7.7.0
        jupyter_client   : 7.2.2
        jupyter_core     : 4.9.2
        jupyter_server   : not installed
        jupyterlab       : not installed
        nbclient         : 0.6.0
        nbconvert        : 6.5.0
        nbformat         : 5.3.0
        notebook         : 6.4.11
        qtconsole        : 5.3.0
        traitlets        : 5.1.1
Chrome Version 104.0.5112.81 (Official Build) (64-bit)

```

#### Description of expected behavior and the observed behavior

When I display the plot  (see code below) multiple times in a Jupyter cell  then the magnitude increases and the display changes. I would expect it to stay the same. There was also some other odd angle behavior but I can't reproduce it now. 

#### Complete, minimal, self-contained example code that reproduces the issue

```
n = 10

x = np.arange(n)
y = x
ang = np.ones(n) * 2
m =  np.ones(n) * 1


vectorfield = hv.VectorField(
        (x, y, ang, m)).options(
        magnitude='Magnitude',
        normalize_lengths=False,
        pivot='tail',
        show_grid=True)


---- 

vectorfield

vectorfield.data

   x  y  Angle  Magnitude
0  0  0    2.0   1.414214
1  1  1    2.0   1.414214
2  2  2    2.0   1.414214
3  3  3    2.0   1.414214
4  4  4    2.0   1.414214
5  5  5    2.0   1.414214
6  6  6    2.0   1.414214
7  7  7    2.0   1.414214
8  8  8    2.0   1.414214
9  9  9    2.0   1.414214

---

vectorfield

---
vectorfield

vectorfield.data



   x  y  Angle  Magnitude
0  0  0    2.0   2.828427
1  1  1    2.0   2.828427
2  2  2    2.0   2.828427
3  3  3    2.0   2.828427
4  4  4    2.0   2.828427
5  5  5    2.0   2.828427
6  6  6    2.0   2.828427
7  7  7    2.0   2.828427
8  8  8    2.0   2.828427
9  9  9    2.0   2.828427
```




Discussion:

Resolving patch:
diff --git a/holoviews/plotting/bokeh/chart.py b/holoviews/plotting/bokeh/chart.py
--- a/holoviews/plotting/bokeh/chart.py
+++ b/holoviews/plotting/bokeh/chart.py
@@ -256,12 +256,12 @@ def _get_lengths(self, element, ranges):
                     magnitudes = magnitudes / max_magnitude
             if self.rescale_lengths:
                 base_dist = get_min_distance(element)
-                magnitudes *= base_dist
+                magnitudes = magnitudes * base_dist
         else:
             magnitudes = np.ones(len(element))
             if self.rescale_lengths:
                 base_dist = get_min_distance(element)
-                magnitudes *= base_dist
+                magnitudes = magnitudes * base_dist
 
         return magnitudes
 


Test patch:
Repository: holoviz/holoviews

Issue:
Game of Life example needs update
### Package versions
```
panel     = 0.13.1
holoviews = 1.15.0
bokeh     = 2.4.3
```


### Bug description
In the Game of Life example in the holoviews documentation (https://holoviews.org/gallery/apps/bokeh/game_of_life.html) 
I needed to update the second to last line
```python
panel.add_periodic_callback(advance, 50)
```

to
```python
pn.state.add_periodic_callback(advance, period=50)   # 50 msec 
# note: the `period=` is not necessary, but I think it adds clarity
```
It seems this is due to a change in the `panel` interface.



Discussion:

Resolving patch:
diff --git a/examples/gallery/apps/bokeh/game_of_life.py b/examples/gallery/apps/bokeh/game_of_life.py
--- a/examples/gallery/apps/bokeh/game_of_life.py
+++ b/examples/gallery/apps/bokeh/game_of_life.py
@@ -91,6 +91,6 @@ def reset_data(x, y):
 
 def advance():
     counter.event(counter=counter.counter+1)
-panel.add_periodic_callback(advance, 50)
+pn.state.add_periodic_callback(advance, period=50, start=False)
 
 panel.servable('Game of Life')


Test patch:
Repository: holoviz/holoviews

Issue:
Empty Box-Whisker plot with the Matplotlib backend when vdims has NaNs
The following snippet correctly returns a Box-Whisker plot grouped by *carrier* with the Bokeh backend but just returns an empty plot with the matplotlib backend.

```python
import holoviews as hv
from hvplot.sample_data import us_crime, airline_flights

flights = airline_flights.to_dask().persist()
flight_subset = flights[flights.carrier.isin(['AA', 'US', 'OH'])]

ds = hv.Dataset(flight_subset, kdims=['carrier'], vdims=['depdelay'])
hv.BoxWhisker(ds)
```
![image](https://user-images.githubusercontent.com/35924738/140918683-7caaf7e2-e1cc-4d75-bde3-b3c56863025e.png)

Note that this has nothing to do with Dask, since adding `flight_subset = flight_subset.compute()` has no effect.

I've done some exploration and found out that the `depdelay` column has `NaN`s values, replacing them with `0` (or any float) fixes the issue. 


Discussion:
Fixed by https://github.com/holoviz/holoviews/pull/5135
Reopening this `1.14.8.` hasn't solved this issue.

Resolving patch:
diff --git a/holoviews/plotting/mpl/stats.py b/holoviews/plotting/mpl/stats.py
--- a/holoviews/plotting/mpl/stats.py
+++ b/holoviews/plotting/mpl/stats.py
@@ -78,7 +78,8 @@ def get_data(self, element, ranges, style):
                 label = ','.join([d.pprint_value(v) for d, v in zip(element.kdims, key)])
             else:
                 label = key
-            data.append(group[group.vdims[0]])
+            d = group[group.vdims[0]]
+            data.append(d[np.isfinite(d)])
             labels.append(label)
         style['labels'] = labels
         style = {k: v for k, v in style.items()


Test patch: