gpilab / core-nodes

The core nodes are a collection of basic data manipulation and visualization algorithms.
http://docs.gpilab.com/en/develop/NodeDev/devguide.html
BSD 3-Clause "New" or "Revised" License
12 stars 6 forks source link

Matplotlib causes a GPI crash with data >2D #15

Closed borupdaniel closed 4 years ago

borupdaniel commented 4 years ago

Tzu-Cheng reported that connecting 3D data to Matplotlib leads to a full-on crash of GPI. I'm able to replicate this and get the following error message:

Traceback (most recent call last):
  File "/Users/m206107/gpi/gpi_core/display/GPI/Matplotlib_GPI.py", line 944, in _on_draw
    self.axes.plot(data, alpha=al, lw=lw)
  File "/Users/m206107/gpi_stack/envs/gpi_new/lib/python3.7/site-packages/matplotlib/__init__.py", line 1867, in inner
    return func(ax, *args, **kwargs)
  File "/Users/m206107/gpi_stack/envs/gpi_new/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 1528, in plot
    for line in self._get_lines(*args, **kwargs):
  File "/Users/m206107/gpi_stack/envs/gpi_new/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 406, in _grab_next_args
    for seg in self._plot_args(this, kwargs):
  File "/Users/m206107/gpi_stack/envs/gpi_new/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 383, in _plot_args
    x, y = self._xy_from_xy(x, y)
  File "/Users/m206107/gpi_stack/envs/gpi_new/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 245, in _xy_from_xy
    "shapes {} and {}".format(x.shape, y.shape))
ValueError: x and y can be no greater than 2-D, but have shapes (3,) and (3, 3, 3)
/Users/m206107/gpi_stack/envs/gpi_new/bin/gpi: line 45: 54930 Abort trap: 6           $GPI_LINK $GPI_LAUNCH $@
borupdaniel commented 4 years ago

I don't think there's any reason to let a user connect 3D+ data to Matplotlib so my approach here will be to restrict the input ports to 1D or 2D.