Skip to content

Commit

Permalink
Merge branch 'master' into plotly
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Sep 21, 2016
2 parents 72464ef + a026943 commit 9898ff4
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -24,7 +24,7 @@ install:
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- conda create -q -c scitools -n test-environment python=$TRAVIS_PYTHON_VERSION scipy numpy freetype nose matplotlib bokeh pandas jupyter ipython=4.2.0 param iris xarray
- conda create -q -c scitools -n test-environment python=$TRAVIS_PYTHON_VERSION scipy numpy freetype nose matplotlib bokeh pandas jupyter ipython=4.2.0 param iris xarray pyqt=4.11
- source activate test-environment
- conda install -q -c conda-forge plotly
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.4" ]]; then
Expand Down
5 changes: 4 additions & 1 deletion README.rst
@@ -1,4 +1,4 @@
|BuildStatus|_ |holoviewsDocs|_ |PyPI|_ |License|_ |Coveralls|_ |Downloads|_ |Gitter|_
|BuildStatus|_ |holoviewsDocs|_ |PyPI|_ |License|_ |Coveralls|_ |Downloads|_ |Gitter|_ |MyBinder|_

holoviews
=========
Expand Down Expand Up @@ -104,3 +104,6 @@ Features

.. |Gitter| image:: https://badges.gitter.im/Join%20Chat.svg
.. _Gitter: https://gitter.im/ioam/holoviews?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

.. |MyBinder| image:: http://mybinder.org/badge.svg
.. _MyBinder: http://mybinder.org/repo/ioam/holoviews
4 changes: 3 additions & 1 deletion holoviews/ipython/display_hooks.py
Expand Up @@ -13,6 +13,7 @@
HoloMap, AdjointLayout, NdLayout, GridSpace, Layout,
CompositeOverlay, DynamicMap)
from ..core.traversal import unique_dimkeys
from ..core.io import FileArchive
from .magics import OutputMagic, OptsMagic

# To assist with debugging of display hooks
Expand Down Expand Up @@ -112,7 +113,8 @@ def wrapped(element):
# Only want to add to the archive for one display hook...
disabled_suffixes = ['png_display', 'svg_display']
if not any(fn.__name__.endswith(suffix) for suffix in disabled_suffixes):
holoviews.archive.add(element, html=html)
if type(holoviews.archive) is not FileArchive:
holoviews.archive.add(element, html=html)
filename = OutputMagic.options['filename']
if filename:
Store.renderers[Store.current_backend].save(element, filename)
Expand Down
10 changes: 6 additions & 4 deletions holoviews/plotting/bokeh/element.py
Expand Up @@ -82,6 +82,9 @@ class ElementPlot(BokehPlot, GenericElementPlot):
invert_yaxis = param.Boolean(default=False, doc="""
Whether to invert the plot y-axis.""")

labelled = param.List(default=['x', 'y'], doc="""
Whether to plot the 'x' and 'y' labels.""")

lod = param.Dict(default={'factor': 10, 'interval': 300,
'threshold': 2000, 'timeout': 500}, doc="""
Bokeh plots offer "Level of Detail" (LOD) capability to
Expand Down Expand Up @@ -161,8 +164,7 @@ class ElementPlot(BokehPlot, GenericElementPlot):
# instance attribute.
_update_handles = ['source', 'glyph']

def __init__(self, element, plot=None, show_labels=['x', 'y'], **params):
self.show_labels = show_labels
def __init__(self, element, plot=None, **params):
self.current_ranges = None
super(ElementPlot, self).__init__(element, **params)
self.handles = {} if plot is None else self.handles['plot']
Expand Down Expand Up @@ -285,8 +287,8 @@ def _init_plot(self, key, element, plots, ranges=None):
xlabel, ylabel, _ = labels
x_axis_type, y_axis_type = axis_types
properties = dict(plot_ranges)
properties['x_axis_label'] = xlabel if 'x' in self.show_labels else ' '
properties['y_axis_label'] = ylabel if 'y' in self.show_labels else ' '
properties['x_axis_label'] = xlabel if 'x' in self.labelled else ' '
properties['y_axis_label'] = ylabel if 'y' in self.labelled else ' '

if self.show_title:
title = self._format_title(key, separator=' ')
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/plot.py
Expand Up @@ -389,11 +389,11 @@ def _create_subplots(self, layout, positions, layout_dimensions, ranges, num=0):
yaxis = 'right-bare' if 'bare' in plot_type.yaxis else 'right'
side_opts = dict(height=main_plot.height, yaxis=yaxis,
width=plot_type.width, invert_axes=True,
show_labels=['y'], xticks=1, xaxis=main_plot.xaxis)
labelled=['y'], xticks=1, xaxis=main_plot.xaxis)
else:
xaxis = 'top-bare' if 'bare' in plot_type.xaxis else 'top'
side_opts = dict(width=main_plot.width, xaxis=xaxis,
height=plot_type.height, show_labels=['x'],
height=plot_type.height, labelled=['x'],
yticks=1, yaxis=main_plot.yaxis)

# Override the plotopts as required
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/tabular.py
Expand Up @@ -19,7 +19,7 @@ class TablePlot(BokehPlot, GenericElementPlot):

_update_handles = ['source', 'glyph']

def __init__(self, element, plot=None, show_labels=['x', 'y'], **params):
def __init__(self, element, plot=None, **params):
super(TablePlot, self).__init__(element, **params)
self.handles = {} if plot is None else self.handles['plot']
element_ids = self.hmap.traverse(lambda x: id(x), [Dataset, ItemTable])
Expand Down
5 changes: 4 additions & 1 deletion holoviews/plotting/mpl/chart3d.py
Expand Up @@ -80,7 +80,10 @@ def _finalize_axis(self, key, **kwargs):
if self.disable_axes:
axis.set_axis_off()

axis.set_axis_bgcolor(self.bgcolor)
if LooseVersion(mpl.__version__) <= '1.5.9':
axis.set_axis_bgcolor(self.bgcolor)
else:
axis.set_facecolor(self.bgcolor)
return super(Plot3D, self)._finalize_axis(key, **kwargs)


Expand Down
9 changes: 7 additions & 2 deletions holoviews/plotting/mpl/element.py
Expand Up @@ -2,6 +2,7 @@

import param
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import ticker
from matplotlib import colors
Expand All @@ -15,6 +16,7 @@
from ..util import dynamic_update
from .plot import MPLPlot
from .util import wrap_formatter
from distutils.version import LooseVersion


class ElementPlot(GenericElementPlot, MPLPlot):
Expand Down Expand Up @@ -149,8 +151,11 @@ def _finalize_axis(self, key, title=None, dimensions=None, ranges=None, xticks=N
subplots = list(self.subplots.values()) if self.subplots else []
if self.zorder == 0 and key is not None:
if self.bgcolor:
axis.set_axis_bgcolor(self.bgcolor)

if LooseVersion(mpl.__version__) <= '1.5.9':
axis.set_axis_bgcolor(self.bgcolor)
else:
axis.set_facecolor(self.bgcolor)

# Apply title
title = None if self.zorder > 0 else self._format_title(key)
if self.show_title and title is not None:
Expand Down

0 comments on commit 9898ff4

Please sign in to comment.