We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Here is a slightly tweaked version of the Points example where the Points element is initialised from a pandas DataFrame instead of a numpy array.
Points
import numpy as np import pandas as pd np.random.seed(10) df = pd.DataFrame(np.random.rand(100, 4), columns=['col1', 'col2', 'col3', 'col4'])
Using an integer for color_index and size_index (as in the Elements tutorial) works as expected:
color_index
size_index
%%opts Points [color_index=2 size_index=3 scaling_factor=50] hv.Points(df)
However, using the names of the data frame columns does not work (using latest master, e3a536d):
%%opts Points [color_index='col3' size_index='col4' scaling_factor=50] hv.Points(df)
Traceback (most recent call last): File "/Users/albert/code/holoviews/holoviews/ipython/display_hooks.py", line 101, in wrapped max_branches = OutputMagic.options['max_branches']) File "/Users/albert/code/holoviews/holoviews/ipython/display_hooks.py", line 143, in element_display return renderer.html(element, fmt=renderer.fig) File "/Users/albert/code/holoviews/holoviews/plotting/renderer.py", line 211, in html plot, fmt = self._validate(obj, fmt) File "/Users/albert/code/holoviews/holoviews/plotting/renderer.py", line 171, in _validate plot = self.get_plot(obj) File "/Users/albert/code/holoviews/holoviews/plotting/renderer.py", line 157, in get_plot plot = self_or_cls.plotting_class(obj)(obj, **plot_opts) File "/Users/albert/code/holoviews/holoviews/plotting/mpl/chart.py", line 23, in __init__ super(ChartPlot, self).__init__(data, **params) File "/Users/albert/code/holoviews/holoviews/plotting/mpl/element.py", line 111, in __init__ super(ElementPlot, self).__init__(element, **params) File "/Users/albert/code/holoviews/holoviews/plotting/plot.py", line 440, in __init__ **dict(params, **plot_opts)) File "/Users/albert/code/holoviews/holoviews/plotting/mpl/plot.py", line 88, in __init__ super(MPLPlot, self).__init__(**params) File "/Users/albert/code/holoviews/holoviews/plotting/plot.py", line 179, in __init__ super(DimensionedPlot, self).__init__(**params) File "/Users/albert/miniconda3/lib/python3.4/site-packages/param/parameterized.py", line 1021, in __init__ self._setup_params(**params) File "/Users/albert/miniconda3/lib/python3.4/site-packages/param/parameterized.py", line 958, in override_initialization fn(parameterized_instance,*args,**kw) File "/Users/albert/miniconda3/lib/python3.4/site-packages/param/parameterized.py", line 1411, in _setup_params setattr(self,name,val) File "/Users/albert/miniconda3/lib/python3.4/site-packages/param/__init__.py", line 563, in __set__ if not callable(val): self._check_value(val) File "/Users/albert/miniconda3/lib/python3.4/site-packages/param/__init__.py", line 692, in _check_value raise ValueError("Parameter '%s' must be an integer."%self._attrib_name) ValueError: Parameter 'color_index' must be an integer.
The text was updated successfully, but these errors were encountered:
Agreed, I've been meaning to allow this for a while now, should be pretty straightforward.
Sorry, something went wrong.
Implemented this in #461, should now work for all size_index and color_index plot options. Closing.
No branches or pull requests
Here is a slightly tweaked version of the
Points
example where thePoints
element is initialised from a pandas DataFrame instead of a numpy array.Using an integer for
color_index
andsize_index
(as in the Elements tutorial) works as expected:However, using the names of the data frame columns does not work (using latest master, e3a536d):
The text was updated successfully, but these errors were encountered: