From 1b9b1a95a69bb0157061be8f7a665b040ae1dd89 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Thu, 23 Feb 2017 15:15:22 +0000 Subject: [PATCH] fix: offline plotting workaround with squeezing arrays --- GPy/plotting/plotly_dep/plot_definitions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GPy/plotting/plotly_dep/plot_definitions.py b/GPy/plotting/plotly_dep/plot_definitions.py index b85f540f..9b659551 100644 --- a/GPy/plotting/plotly_dep/plot_definitions.py +++ b/GPy/plotting/plotly_dep/plot_definitions.py @@ -128,7 +128,9 @@ class PlotlyPlotsBase(AbstractPlottingLibrary): marker_kwargs = marker_kwargs or {} if 'symbol' not in marker_kwargs: marker_kwargs['symbol'] = marker + X, Y = np.squeeze(X), np.squeeze(Y) if Z is not None: + Z = np.squeeze(Z) return Scatter3d(x=X, y=Y, z=Z, mode='markers', showlegend=label is not None, marker=Marker(color=color, colorscale=cmap, **marker_kwargs), @@ -140,7 +142,9 @@ class PlotlyPlotsBase(AbstractPlottingLibrary): def plot(self, ax, X, Y, Z=None, color=None, label=None, line_kwargs=None, **kwargs): if 'mode' not in kwargs: kwargs['mode'] = 'lines' + X, Y = np.squeeze(X), np.squeeze(Y) if Z is not None: + Z = np.squeeze(Z) return Scatter3d(x=X, y=Y, z=Z, showlegend=label is not None, line=Line(color=color, **line_kwargs or {}), name=label, **kwargs) return Scatter(x=X, y=Y, showlegend=label is not None, line=Line(color=color, **line_kwargs or {}), name=label, **kwargs) @@ -186,7 +190,9 @@ class PlotlyPlotsBase(AbstractPlottingLibrary): error_kwargs.update(dict(array=error[1], arrayminus=error[0], symmetric=False)) else: error_kwargs.update(dict(array=error, symmetric=True)) + X, Y = np.squeeze(X), np.squeeze(Y) if Z is not None: + Z = np.squeeze(Z) return Scatter3d(x=X, y=Y, z=Z, mode='markers', error_x=ErrorX(color=color, **error_kwargs or {}), marker=Marker(size='0'), name=label, @@ -203,7 +209,9 @@ class PlotlyPlotsBase(AbstractPlottingLibrary): error_kwargs.update(dict(array=error[1], arrayminus=error[0], symmetric=False)) else: error_kwargs.update(dict(array=error, symmetric=True)) + X, Y = np.squeeze(X), np.squeeze(Y) if Z is not None: + Z = np.squeeze(Z) return Scatter3d(x=X, y=Y, z=Z, mode='markers', error_y=ErrorY(color=color, **error_kwargs or {}), marker=Marker(size='0'), name=label,