diff --git a/packages/python/plotly/plotly/figure_factory/_ternary_contour.py b/packages/python/plotly/plotly/figure_factory/_ternary_contour.py index f45a9fcc135..52c7099bced 100644 --- a/packages/python/plotly/plotly/figure_factory/_ternary_contour.py +++ b/packages/python/plotly/plotly/figure_factory/_ternary_contour.py @@ -6,9 +6,9 @@ from plotly.graph_objs import graph_objs as go np = optional_imports.get_module("numpy") -sk_measure = optional_imports.get_module("skimage.measure") scipy_interp = optional_imports.get_module("scipy.interpolate") +from skimage import measure # -------------------------- Layout ------------------------------ @@ -305,8 +305,8 @@ def _extract_contours(im, values, colors): all_contours1, all_values1, all_areas1, all_colors1 = [], [], [], [] all_contours2, all_values2, all_areas2, all_colors2 = [], [], [], [] for i, val in enumerate(values): - contour_level1 = sk_measure.find_contours(zz_min, val) - contour_level2 = sk_measure.find_contours(zz_max, val) + contour_level1 = measure.find_contours(zz_min, val) + contour_level2 = measure.find_contours(zz_max, val) all_contours1.extend(contour_level1) all_contours2.extend(contour_level2) all_values1.extend([val] * len(contour_level1)) @@ -614,6 +614,7 @@ def create_ternary_contour( """\ The create_ternary_contour figure factory requires the scipy package""" ) + sk_measure = optional_imports.get_module("skimage") if sk_measure is None: raise ImportError( """\ diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py b/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py new file mode 100644 index 00000000000..001bdb6997a --- /dev/null +++ b/packages/python/plotly/plotly/tests/test_core/test_px/test_px.py @@ -0,0 +1,12 @@ +import plotly.express as px +import numpy as np + + +def test_scatter(): + iris = px.data.iris() + fig = px.scatter(iris, x="sepal_width", y="sepal_length") + assert fig.data[0].type == "scatter" + assert np.all(fig.data[0].x == iris.sepal_width) + assert np.all(fig.data[0].y == iris.sepal_length) + # test defaults + assert fig.data[0].mode == "markers" diff --git a/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py b/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py index 2d009798059..a08353a9026 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_figure_factory/test_figure_factory.py @@ -15,7 +15,7 @@ shapely = optional_imports.get_module("shapely") shapefile = optional_imports.get_module("shapefile") gp = optional_imports.get_module("geopandas") -sk_measure = optional_imports.get_module("skimage.measure") +sk_measure = optional_imports.get_module("skimage") class TestDistplot(NumpyTestUtilsMixin, TestCaseNoTemplate): diff --git a/packages/python/plotly/tox.ini b/packages/python/plotly/tox.ini index 4a0a056591b..df41b7e1df1 100644 --- a/packages/python/plotly/tox.ini +++ b/packages/python/plotly/tox.ini @@ -59,14 +59,14 @@ deps= pytz==2016.10 retrying==1.3.3 pytest==3.5.1 + pandas==0.24.2 backports.tempfile==1.0 optional: --editable=file:///{toxinidir}/../plotly-geo - optional: numpy==1.11.3 + optional: numpy==1.16.5 optional: ipython[all]==5.1.0 optional: ipywidgets==7.2.0 optional: ipykernel==4.8.2 optional: jupyter==1.0.0 - optional: pandas==0.19.2 optional: scipy==0.18.1 optional: shapely==1.6.4 optional: geopandas==0.3.0 @@ -74,7 +74,7 @@ deps= optional: pillow==5.2.0 optional: matplotlib==2.2.3 optional: xarray==0.10.9 - optional: scikit-image==0.13.1 + optional: scikit-image==0.14.4 ; CORE ENVIRONMENTS [testenv:py27-core]