Skip to content

Commit

Permalink
fixed skimage import (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelle authored Oct 18, 2019
1 parent b7ad543 commit ff23511
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/python/plotly/plotly/express/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
`plotly_express` is a terse, consistent, high-level wrapper around `plotly` for rapid \
data exploration and figure generation. See the gallery at https://plotly.github.io/plotly_express
"""
from __future__ import absolute_import
from plotly import optional_imports

pd = optional_imports.get_module("pandas")
if pd is None:
raise ImportError(
"""\
Plotly express requires pandas to be installed."""
)


from ._chart_types import ( # noqa: F401
scatter,
Expand Down
15 changes: 14 additions & 1 deletion packages/python/plotly/plotly/figure_factory/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,31 @@
from plotly.figure_factory._scatterplot import create_scatterplotmatrix
from plotly.figure_factory._streamline import create_streamline
from plotly.figure_factory._table import create_table
from plotly.figure_factory._ternary_contour import create_ternary_contour
from plotly.figure_factory._trisurf import create_trisurf
from plotly.figure_factory._violin import create_violin

if optional_imports.get_module("pandas") is not None:
from plotly.figure_factory._county_choropleth import create_choropleth
else:

def create_choropleth(*args, **kwargs):
raise ImportError("Please install pandas to use `create_choropleth`")


if optional_imports.get_module("skimage") is not None:
from plotly.figure_factory._ternary_contour import create_ternary_contour
else:

def create_ternary_contour(*args, **kwargs):
raise ImportError("Please install scikit-image to use `create_ternary_contour`")


__all__ = [
"create_2d_density",
"create_annotated_heatmap",
"create_bullet",
"create_candlestick",
"create_choropleth",
"create_dendrogram",
"create_distplot",
"create_facet_grid",
Expand Down
1 change: 1 addition & 0 deletions packages/python/plotly/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ deps=
optional: pillow==5.2.0
optional: matplotlib==2.2.3
optional: xarray==0.10.9
optional: pywavelets==1.0.3
optional: scikit-image==0.14.4

; CORE ENVIRONMENTS
Expand Down

0 comments on commit ff23511

Please sign in to comment.