import hvplot.pandas
from bokeh.sampledata.iris import flowers as df
plot = df.hvplot.scatter(
x='sepal_length', y='sepal_width', by='species',
legend='top', height=400, width=400,
color={"setosa": "pink"}
)
TypeError: unhashable type: 'dict'
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/bokeh/application/handlers/code_runner.py", line 231, in run
exec(self._code, module.__dict__)
File "/home/jovyan/repos/private/hvplot/script.py", line 4, in <module>
plot = df.hvplot.scatter(
File "/home/jovyan/repos/private/hvplot/hvplot/plotting/core.py", line 300, in scatter
return self(x, y, kind='scatter', **kwds)
File "/home/jovyan/repos/private/hvplot/hvplot/plotting/core.py", line 85, in __call__
return self._get_converter(x, y, kind, **kwds)(kind, x, y)
File "/home/jovyan/repos/private/hvplot/hvplot/converter.py", line 1228, in __call__
obj = method(x, y)
File "/home/jovyan/repos/private/hvplot/hvplot/converter.py", line 1641, in scatter
return self.chart(Scatter, x, y, data)
File "/home/jovyan/repos/private/hvplot/hvplot/converter.py", line 1599, in chart
return self.single_chart(element, x, y, data)
File "/home/jovyan/repos/private/hvplot/hvplot/converter.py", line 1488, in single_chart
if 'color' in opts_ and opts_['color'] in data.columns:
File "/opt/conda/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 4572, in __contains__
hash(key)
TypeError: unhashable type: 'dict'
I believe this should work because its powerful and users would expect it to work as it works for the reference Pandas .plot implementation.
Request
Enable using a
dict
forcolor
inline
plots and what ever other types of plots where it makes sense.Motivation
I'm trying to improve the docstrings of hvPlot.
As the
It is very hard to figure out which types are supported.
So instead I assume hvPlot supports the same api and types as Pandas
.plot
.Now I want to document the basic
by
andcolor
. I cannot find any documentation in the docstrings, reference guide or withhvplot.help('line')
.So I look up https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.line.html and can see that they support
color
to be of typedict
. The only way I can figure out if this is supported in hvPlot is to try it out.It fails
I believe this should work because its powerful and users would expect it to work as it works for the reference Pandas
.plot
implementation.