Skip to content

Commit

Permalink
Merge pull request #585 from ioam/seaborn_fixes
Browse files Browse the repository at this point in the history
Fixed bugs in seaborn and pandas plotting interfaces
  • Loading branch information
jlstevens committed Mar 30, 2016
2 parents ad73056 + a0318c8 commit b344b9a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/Tutorials/Pandas_Seaborn.ipynb
Expand Up @@ -214,7 +214,7 @@
},
"outputs": [],
"source": [
"%%opts TimeSeries [apply_databounds=True] (ci=95 color='indianred')\n",
"%%opts TimeSeries (ci=95 color='indianred')\n",
"sine_stack"
]
},
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/mpl/pandas.py
Expand Up @@ -70,7 +70,8 @@ def initialize_plot(self, ranges=None):
element = self.hmap.last
self._validate(element)

self._update_plot(element)
style = self._process_style(self.style[self.cyclic_index])
self._update_plot(axis, element, style)
if 'fig' in self.handles and self.handles['fig'] != plt.gcf():
self.handles['fig'] = plt.gcf()

Expand Down Expand Up @@ -122,7 +123,6 @@ def _validate(self, dfview):


def _update_plot(self, axis, view, style):
style = self._process_style(style)
if self.plot_type == 'scatter_matrix':
pd.scatter_matrix(view.data, ax=axis, **style)
elif self.plot_type == 'autocorrelation_plot':
Expand Down
9 changes: 5 additions & 4 deletions holoviews/plotting/mpl/seaborn.py
Expand Up @@ -233,7 +233,9 @@ def initialize_plot(self, ranges=None):
axis = self.handles['axis']
self._validate(dfview)

self._update_plot(axis, dfview)
style = self._process_style(self.style[self.cyclic_index])

self._update_plot(axis, dfview, style)
if 'fig' in self.handles and self.handles['fig'] != plt.gcf():
self.handles['fig'] = plt.gcf()

Expand Down Expand Up @@ -269,8 +271,7 @@ def update_frame(self, key, ranges=None):
self._finalize_axis(key, **(axis_kwargs if axis_kwargs else {}))


def _update_plot(self, axis, view):
style = self._process_style(self.style[self.cyclic_index])
def _update_plot(self, axis, view, style):
if self.plot_type == 'factorplot':
opts = dict(style, **({'hue': view.x2} if view.x2 else {}))
sns.factorplot(x=view.x, y=view.y, data=view.data, **opts)
Expand Down Expand Up @@ -310,7 +311,7 @@ def _update_plot(self, axis, view):
plt.close(self.handles['fig'])
self.handles['fig'] = plt.gcf()
else:
super(SNSFramePlot, self)._update_plot(axis, view)
super(SNSFramePlot, self)._update_plot(axis, view, style)


Store.register({TimeSeries: TimeSeriesPlot,
Expand Down

0 comments on commit b344b9a

Please sign in to comment.