From 89405d94103abdfd062cad13539d29033d135d5c Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Wed, 12 Jun 2019 10:56:55 +0200 Subject: [PATCH 1/6] gantt ff should return go.Figure object --- plotly-package/plotly/figure_factory/_gantt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plotly-package/plotly/figure_factory/_gantt.py b/plotly-package/plotly/figure_factory/_gantt.py index e341655b9ce..7716eaea881 100644 --- a/plotly-package/plotly/figure_factory/_gantt.py +++ b/plotly-package/plotly/figure_factory/_gantt.py @@ -420,7 +420,7 @@ def gantt_colorscale(chart, colors, title, index_col, show_colorbar, bar_width, ) layout['shapes'] = tasks - fig = dict(data=data, layout=layout) + fig = graph_objs.Figure(data=data, layout=layout) return fig @@ -578,7 +578,7 @@ def gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width, ) layout['shapes'] = tasks - fig = dict(data=data, layout=layout) + fig = graph_objs.Figure(data=data, layout=layout) return fig From 68ba1b75c17d8cb786fb271e28c38c87d0e0ce13 Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Wed, 12 Jun 2019 11:08:30 +0200 Subject: [PATCH 2/6] changed default size because with 900 the chart overflows in a notebook --- plotly-package/plotly/figure_factory/_gantt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly-package/plotly/figure_factory/_gantt.py b/plotly-package/plotly/figure_factory/_gantt.py index 7716eaea881..2e8f0e4a5b9 100644 --- a/plotly-package/plotly/figure_factory/_gantt.py +++ b/plotly-package/plotly/figure_factory/_gantt.py @@ -584,7 +584,7 @@ def gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width, def create_gantt(df, colors=None, index_col=None, show_colorbar=False, reverse_colors=False, title='Gantt Chart', bar_width=0.2, - showgrid_x=False, showgrid_y=False, height=600, width=900, + showgrid_x=False, showgrid_y=False, height=600, width=800, tasks=None, task_names=None, data=None, group_tasks=False): """ Returns figure for a gantt chart From e94ea1a961e1ead1111170e8122cd8cbfd8e20d7 Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Wed, 12 Jun 2019 11:28:07 +0200 Subject: [PATCH 3/6] fixed tests --- .../test_tools/test_figure_factory.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/plotly-package/plotly/tests/test_optional/test_tools/test_figure_factory.py b/plotly-package/plotly/tests/test_optional/test_tools/test_figure_factory.py index 4f0c27e4f7b..aa2b180c33f 100644 --- a/plotly-package/plotly/tests/test_optional/test_tools/test_figure_factory.py +++ b/plotly-package/plotly/tests/test_optional/test_tools/test_figure_factory.py @@ -1651,22 +1651,20 @@ def test_gannt_groups_and_descriptions(self): } self.assertEqual(test_gantt_chart['data'][0], - exp_gantt_chart['data'][0]) + graph_objs.Scatter(exp_gantt_chart['data'][0])) self.assertEqual(test_gantt_chart['data'][1], - exp_gantt_chart['data'][1]) + graph_objs.Scatter(exp_gantt_chart['data'][1])) self.assertEqual(test_gantt_chart['data'][2], - exp_gantt_chart['data'][2]) + graph_objs.Scatter(exp_gantt_chart['data'][2])) self.assertEqual(test_gantt_chart['data'][3], - exp_gantt_chart['data'][3]) + graph_objs.Scatter(exp_gantt_chart['data'][3])) self.assertEqual(test_gantt_chart['data'][4], - exp_gantt_chart['data'][4]) + graph_objs.Scatter(exp_gantt_chart['data'][4])) - self.assertEqual(test_gantt_chart['layout'], - exp_gantt_chart['layout']) def test_gantt_all_args(self): @@ -1756,13 +1754,11 @@ def test_gantt_all_args(self): } self.assertEqual(test_gantt_chart['data'][0], - exp_gantt_chart['data'][0]) + graph_objs.Scatter(exp_gantt_chart['data'][0])) self.assertEqual(test_gantt_chart['data'][1], - exp_gantt_chart['data'][1]) + graph_objs.Scatter(exp_gantt_chart['data'][1])) - self.assertEqual(test_gantt_chart['layout'], - exp_gantt_chart['layout']) class Test2D_Density(TestCaseNoTemplate, NumpyTestUtilsMixin): From 46fc7f3ae0d52cf516e9d339567bf5313031fab8 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Thu, 4 Jul 2019 06:11:04 -0400 Subject: [PATCH 4/6] Revert gantt width change to fix tests --- plotly-package/plotly/figure_factory/_gantt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly-package/plotly/figure_factory/_gantt.py b/plotly-package/plotly/figure_factory/_gantt.py index 2e8f0e4a5b9..7716eaea881 100644 --- a/plotly-package/plotly/figure_factory/_gantt.py +++ b/plotly-package/plotly/figure_factory/_gantt.py @@ -584,7 +584,7 @@ def gantt_dict(chart, colors, title, index_col, show_colorbar, bar_width, def create_gantt(df, colors=None, index_col=None, show_colorbar=False, reverse_colors=False, title='Gantt Chart', bar_width=0.2, - showgrid_x=False, showgrid_y=False, height=600, width=800, + showgrid_x=False, showgrid_y=False, height=600, width=900, tasks=None, task_names=None, data=None, group_tasks=False): """ Returns figure for a gantt chart From 22f3509dddb3b4761c605b48e0321fd274feaf96 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Thu, 4 Jul 2019 07:49:23 -0400 Subject: [PATCH 5/6] Change width back to 800 --- packages/python/plotly/plotly/figure_factory/_gantt.py | 2 +- .../test_optional/test_figure_factory/test_figure_factory.py | 2 +- .../tests/test_optional/test_tools/test_figure_factory.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/python/plotly/plotly/figure_factory/_gantt.py b/packages/python/plotly/plotly/figure_factory/_gantt.py index 38a94a0a01b..dda8177c3e0 100644 --- a/packages/python/plotly/plotly/figure_factory/_gantt.py +++ b/packages/python/plotly/plotly/figure_factory/_gantt.py @@ -582,7 +582,7 @@ def create_gantt( showgrid_x=False, showgrid_y=False, height=600, - width=900, + width=800, tasks=None, task_names=None, data=None, 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 2f431ffb356..a792cee7f41 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 @@ -2090,7 +2090,7 @@ def test_df_dataframe_all_args(self): ], "showlegend": False, "title": {"text": "Gantt Chart"}, - "width": 900, + "width": 800, "xaxis": { "rangeselector": { "buttons": [ diff --git a/packages/python/plotly/plotly/tests/test_optional/test_tools/test_figure_factory.py b/packages/python/plotly/plotly/tests/test_optional/test_tools/test_figure_factory.py index 699f708739a..1fd0b059664 100644 --- a/packages/python/plotly/plotly/tests/test_optional/test_tools/test_figure_factory.py +++ b/packages/python/plotly/plotly/tests/test_optional/test_tools/test_figure_factory.py @@ -1944,7 +1944,7 @@ def test_gannt_groups_and_descriptions(self): ], "showlegend": True, "title": "Gantt Chart", - "width": 900, + "width": 800, "xaxis": { "rangeselector": { "buttons": [ From d9a8fd2df235d5f34a0e697cfb100656a0d8a583 Mon Sep 17 00:00:00 2001 From: Jon Mease Date: Thu, 4 Jul 2019 08:03:43 -0400 Subject: [PATCH 6/6] Fix test_sg_scraper test path --- .../python/plotly/plotly/tests/test_orca/test_sg_scraper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/python/plotly/plotly/tests/test_orca/test_sg_scraper.py b/packages/python/plotly/plotly/tests/test_orca/test_sg_scraper.py index abb68af292f..837943ab45b 100644 --- a/packages/python/plotly/plotly/tests/test_orca/test_sg_scraper.py +++ b/packages/python/plotly/plotly/tests/test_orca/test_sg_scraper.py @@ -12,6 +12,9 @@ def setup(): plotly.io.orca.config.restore_defaults(reset_server=False) +here = os.path.dirname(os.path.abspath(__file__)) + + # Run setup before every test function in this file pytestmark = pytest.mark.usefixtures("setup") @@ -47,7 +50,7 @@ def test_scraper(): import tempfile tempdir = tempfile.mkdtemp() - gallery_conf = {"src_dir": tempdir, "examples_dirs": "plotly/tests/test_orca"} + gallery_conf = {"src_dir": tempdir, "examples_dirs": here} names = iter(["0", "1", "2"]) block_vars = {"image_path_iterator": names} execute_plotly_example()