Skip to content

Commit

Permalink
Merge pull request #1156 from ioam/fix_reg_plot
Browse files Browse the repository at this point in the history
Fix seaborn Regression plot
  • Loading branch information
jlstevens authored Feb 27, 2017
2 parents 336ccf6 + 38d68d7 commit 727bf58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion holoviews/plotting/mpl/seaborn.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ class RegressionPlot(SeabornPlot):
'x_jitter', 'y_jitter', 'x_partial', 'y_partial']

def init_artists(self, ax, plot_data, plot_kwargs):
plot_kwargs.pop('zorder')
return {'axis': sns.regplot(*plot_data, ax=ax, **plot_kwargs)}

def get_data(self, element, ranges, style):
xs, ys = (element[d] for d in self.dimensions()[:1])
xs, ys = (element[d] for d in element.dimensions()[:2])
return (xs, ys), style, {}


Expand Down
15 changes: 15 additions & 0 deletions tests/testplotinstantiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
except:
mpl_renderer = None


try:
import seaborn as sns
from holoviews.interface.seaborn import Regression
except:
sns = None

try:
import holoviews.plotting.bokeh
bokeh_renderer = Store.renderers['bokeh']
Expand Down Expand Up @@ -97,6 +104,14 @@ def test_interleaved_overlay(self):
o = Overlay([Curve(np.array([[0, 1]])) , Scatter([[1,1]]) , Curve(np.array([[0, 1]]))])
OverlayPlot(o)

def test_regression_plot_initializes(self):
if sns is None:
raise SkipTest("Seaborn required to test Regression plot")
reg = Regression(np.random.rand(20,2))
plot = mpl_renderer.get_plot(reg)
axis = plot.handles['axis']
plot.initialize_plot()

def test_dynamic_nonoverlap(self):
kdims = [Dimension('File', range=(0.01, 1)),
Dimension('SliceDimension', range=(0.01, 1)),
Expand Down

0 comments on commit 727bf58

Please sign in to comment.