Skip to content

Commit

Permalink
Support for constructing Charts with only y-values
Browse files Browse the repository at this point in the history
This simplifies constructing simple plots without supplying
explicit x-values. This more closely matches the matplotlib
API making it easier for new users to get started and
addresses issue #133.
  • Loading branch information
philippjfr committed Jun 3, 2015
1 parent 3b63c93 commit 2297375
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion holoviews/element/chart.py
Expand Up @@ -45,10 +45,13 @@ def __init__(self, data, **params):


def _validate_data(self, data):
if data.ndim > 1 and not data.shape[1] == len(self.dimensions()):
if data.ndim == 1:
data = np.array(zip(range(len(data)), data))
if not data.shape[1] == len(self.dimensions()):
raise ValueError("Data has to match number of key and value dimensions")
return data


def _process_map(self, ndmap):
"""
Base class to process an NdMapping to be collapsed into a Chart.
Expand Down

0 comments on commit 2297375

Please sign in to comment.