pysal / notebooks

jupyter/ipython notebooks demonstrating PySAL functionality
54 stars 38 forks source link

Value Error: Sparse Categorical Speed #64

Open thedatalass opened 5 years ago

thedatalass commented 5 years ago

Sparse Categorical Speed

x = np.arange(25, 250, 25)
plt.plot(x, spcat1, x, spcat1a, x, spcat1b, x, spcat2)
plt.legend(('spcat1', 'spcat1a', 'spcat1b', 'spcat2'))
plt.title('Speed of Sparse Dummy Functions')
plt.xlabel('Sample Size')
plt.ylabel('Seconds')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-afa502da7217> in <module>
      1 x = np.arange(25, 250, 25)
----> 2 plt.plot(x, spcat1, x, spcat1a, x, spcat1b, x, spcat2)
      3 plt.legend(('spcat1', 'spcat1a', 'spcat1b', 'spcat2'))
      4 plt.title('Speed of Sparse Dummy Functions')
      5 plt.xlabel('Sample Size')

/srv/conda/lib/python3.7/site-packages/matplotlib/pyplot.py in plot(scalex, scaley, data, *args, **kwargs)
   2809     return gca().plot(
   2810         *args, scalex=scalex, scaley=scaley, **({"data": data} if data
-> 2811         is not None else {}), **kwargs)
   2812 
   2813 

/srv/conda/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1808                         "the Matplotlib list!)" % (label_namer, func.__name__),
   1809                         RuntimeWarning, stacklevel=2)
-> 1810             return func(ax, *args, **kwargs)
   1811 
   1812         inner.__doc__ = _add_data_doc(inner.__doc__,

/srv/conda/lib/python3.7/site-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, *args, **kwargs)
   1609         kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D._alias_map)
   1610 
-> 1611         for line in self._get_lines(*args, **kwargs):
   1612             self.add_line(line)
   1613             lines.append(line)

/srv/conda/lib/python3.7/site-packages/matplotlib/axes/_base.py in _grab_next_args(self, *args, **kwargs)
    391                 this += args[0],
    392                 args = args[1:]
--> 393             yield from self._plot_args(this, kwargs)
    394 
    395 

/srv/conda/lib/python3.7/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
    368             x, y = index_of(tup[-1])
    369 
--> 370         x, y = self._xy_from_xy(x, y)
    371 
    372         if self.command == 'plot':

/srv/conda/lib/python3.7/site-packages/matplotlib/axes/_base.py in _xy_from_xy(self, x, y)
    229         if x.shape[0] != y.shape[0]:
    230             raise ValueError("x and y must have same first dimension, but "
--> 231                              "have shapes {} and {}".format(x.shape, y.shape))
    232         if x.ndim > 2 or y.ndim > 2:
    233             raise ValueError("x and y can be no greater than 2-D, but have "

ValueError: x and y must have same first dimension, but have shapes (9,) and (0,)
ljwolf commented 5 years ago

This binder link is broken... can you give a URL (not in binder) to the notebook this refers to?

thedatalass commented 5 years ago

Hello - I can't find the URL to the notebook. It was named "Sparse Categorical Speed"