Repository: plotly/plotly.py

Issue:
Sync matplotlylib submodule
As mentioned in https://github.com/plotly/plotly.py/issues/1390#issuecomment-453975205, we should sync the matplotlylib submodule to pull in the upstream updates.


Discussion:
And like chunked requests, I believe we have new commits in plotly's matplotlylib files so we probably want to push those upstream if appropriate.

Resolving patch:
diff --git a/plotly/matplotlylib/mplexporter/exporter.py b/plotly/matplotlylib/mplexporter/exporter.py
--- a/plotly/matplotlylib/mplexporter/exporter.py
+++ b/plotly/matplotlylib/mplexporter/exporter.py
@@ -10,7 +10,7 @@
 
 import matplotlib
 from matplotlib import transforms, collections
-
+from matplotlib.backends.backend_agg import FigureCanvasAgg
 
 class Exporter(object):
     """Matplotlib Exporter
@@ -42,6 +42,8 @@ def run(self, fig):
         """
         # Calling savefig executes the draw() command, putting elements
         # in the correct place.
+        if fig.canvas is None:
+            canvas = FigureCanvasAgg(fig)
         fig.savefig(io.BytesIO(), format='png', dpi=fig.dpi)
         if self.close_mpl:
             import matplotlib.pyplot as plt
@@ -157,13 +159,16 @@ def crawl_legend(self, ax, legend):
             # force a large zorder so it appears on top
             child.set_zorder(1E6 + child.get_zorder())
 
+            # reorder border box to make sure marks are visible
+            if isinstance(child, matplotlib.patches.FancyBboxPatch):
+                child.set_zorder(child.get_zorder()-1)
+
             try:
                 # What kind of object...
                 if isinstance(child, matplotlib.patches.Patch):
                     self.draw_patch(ax, child, force_trans=ax.transAxes)
                 elif isinstance(child, matplotlib.text.Text):
-                    if not (child is legend.get_children()[-1]
-                            and child.get_text() == 'None'):
+                    if child.get_text() != 'None':
                         self.draw_text(ax, child, force_trans=ax.transAxes)
                 elif isinstance(child, matplotlib.lines.Line2D):
                     self.draw_line(ax, child, force_trans=ax.transAxes)
@@ -181,7 +186,8 @@ def draw_line(self, ax, line, force_trans=None):
                                                    ax, line.get_xydata(),
                                                    force_trans=force_trans)
         linestyle = utils.get_line_style(line)
-        if linestyle['dasharray'] in ['None', 'none', None]:
+        if (linestyle['dasharray'] is None
+                and linestyle['drawstyle'] == 'default'):
             linestyle = None
         markerstyle = utils.get_marker_style(line)
         if (markerstyle['marker'] in ['None', 'none', None]
diff --git a/plotly/matplotlylib/mplexporter/renderers/base.py b/plotly/matplotlylib/mplexporter/renderers/base.py
--- a/plotly/matplotlylib/mplexporter/renderers/base.py
+++ b/plotly/matplotlylib/mplexporter/renderers/base.py
@@ -1,8 +1,10 @@
 import warnings
 import itertools
 from contextlib import contextmanager
+from distutils.version import LooseVersion
 
 import numpy as np
+import matplotlib as mpl
 from matplotlib import transforms
 
 from .. import utils
@@ -189,8 +191,11 @@ def _iter_path_collection(paths, path_transforms, offsets, styles):
         """Build an iterator over the elements of the path collection"""
         N = max(len(paths), len(offsets))
 
-        if not path_transforms:
-            path_transforms = [np.eye(3)]
+        # Before mpl 1.4.0, path_transform can be a false-y value, not a valid
+        # transformation matrix.
+        if LooseVersion(mpl.__version__) < LooseVersion('1.4.0'):
+            if path_transforms is None:
+                path_transforms = [np.eye(3)]
 
         edgecolor = styles['edgecolor']
         if np.size(edgecolor) == 0:
@@ -260,8 +265,8 @@ def draw_path_collection(self, paths, path_coordinates, path_transforms,
             # This is a hack:
             if path_coordinates == "figure":
                 path_coordinates = "points"
-            style = {"edgecolor": utils.color_to_hex(ec),
-                     "facecolor": utils.color_to_hex(fc),
+            style = {"edgecolor": utils.export_color(ec),
+                     "facecolor": utils.export_color(fc),
                      "edgewidth": lw,
                      "dasharray": "10,0",
                      "alpha": styles['alpha'],
diff --git a/plotly/matplotlylib/mplexporter/utils.py b/plotly/matplotlylib/mplexporter/utils.py
--- a/plotly/matplotlylib/mplexporter/utils.py
+++ b/plotly/matplotlylib/mplexporter/utils.py
@@ -18,29 +18,33 @@
 from matplotlib import ticker
 
 
-def color_to_hex(color):
-    """Convert matplotlib color code to hex color code"""
+def export_color(color):
+    """Convert matplotlib color code to hex color or RGBA color"""
     if color is None or colorConverter.to_rgba(color)[3] == 0:
         return 'none'
-    else:
+    elif colorConverter.to_rgba(color)[3] == 1:
         rgb = colorConverter.to_rgb(color)
         return '#{0:02X}{1:02X}{2:02X}'.format(*(int(255 * c) for c in rgb))
+    else:
+        c = colorConverter.to_rgba(color)
+        return "rgba(" + ", ".join(str(int(np.round(val * 255)))
+                                        for val in c[:3])+', '+str(c[3])+")"
 
 
-def many_to_one(input_dict):
+def _many_to_one(input_dict):
     """Convert a many-to-one mapping to a one-to-one mapping"""
     return dict((key, val)
                 for keys, val in input_dict.items()
                 for key in keys)
 
-LINESTYLES = many_to_one({('solid', '-', (None, None)): "10,0",
-                          ('dashed', '--'): "6,6",
-                          ('dotted', ':'): "2,2",
-                          ('dashdot', '-.'): "4,4,2,4",
-                          ('', ' ', 'None', 'none'): "none"})
+LINESTYLES = _many_to_one({('solid', '-', (None, None)): 'none',
+                           ('dashed', '--'): "6,6",
+                           ('dotted', ':'): "2,2",
+                           ('dashdot', '-.'): "4,4,2,4",
+                           ('', ' ', 'None', 'none'): None})
 
 
-def get_dasharray(obj, i=None):
+def get_dasharray(obj):
     """Get an SVG dash array for the given matplotlib linestyle
 
     Parameters
@@ -48,7 +52,6 @@ def get_dasharray(obj, i=None):
     obj : matplotlib object
         The matplotlib line or path object, which must have a get_linestyle()
         method which returns a valid matplotlib line code
-    i : integer (optional)
 
     Returns
     -------
@@ -59,14 +62,11 @@ def get_dasharray(obj, i=None):
         return ','.join(map(str, obj._dashSeq))
     else:
         ls = obj.get_linestyle()
-        if i is not None:
-            ls = ls[i]
-
-        dasharray = LINESTYLES.get(ls, None)
-        if dasharray is None:
-            warnings.warn("dash style '{0}' not understood: "
-                          "defaulting to solid.".format(ls))
-            dasharray = LINESTYLES['-']
+        dasharray = LINESTYLES.get(ls, 'not found')
+        if dasharray == 'not found':
+            warnings.warn("line style '{0}' not understood: "
+                          "defaulting to solid line.".format(ls))
+            dasharray = LINESTYLES['solid']
         return dasharray
 
 
@@ -121,9 +121,9 @@ def get_path_style(path, fill=True):
     style['alpha'] = path.get_alpha()
     if style['alpha'] is None:
         style['alpha'] = 1
-    style['edgecolor'] = color_to_hex(path.get_edgecolor())
+    style['edgecolor'] = export_color(path.get_edgecolor())
     if fill:
-        style['facecolor'] = color_to_hex(path.get_facecolor())
+        style['facecolor'] = export_color(path.get_facecolor())
     else:
         style['facecolor'] = 'none'
     style['edgewidth'] = path.get_linewidth()
@@ -138,10 +138,11 @@ def get_line_style(line):
     style['alpha'] = line.get_alpha()
     if style['alpha'] is None:
         style['alpha'] = 1
-    style['color'] = color_to_hex(line.get_color())
+    style['color'] = export_color(line.get_color())
     style['linewidth'] = line.get_linewidth()
     style['dasharray'] = get_dasharray(line)
     style['zorder'] = line.get_zorder()
+    style['drawstyle'] = line.get_drawstyle()
     return style
 
 
@@ -152,8 +153,8 @@ def get_marker_style(line):
     if style['alpha'] is None:
         style['alpha'] = 1
 
-    style['facecolor'] = color_to_hex(line.get_markerfacecolor())
-    style['edgecolor'] = color_to_hex(line.get_markeredgecolor())
+    style['facecolor'] = export_color(line.get_markerfacecolor())
+    style['edgecolor'] = export_color(line.get_markeredgecolor())
     style['edgewidth'] = line.get_markeredgewidth()
 
     style['marker'] = line.get_marker()
@@ -175,9 +176,10 @@ def get_text_style(text):
     if style['alpha'] is None:
         style['alpha'] = 1
     style['fontsize'] = text.get_size()
-    style['color'] = color_to_hex(text.get_color())
+    style['color'] = export_color(text.get_color())
     style['halign'] = text.get_horizontalalignment()  # left, center, right
     style['valign'] = text.get_verticalalignment()  # baseline, center, top
+    style['malign'] = text._multialignment # text alignment when '\n' in text
     style['rotation'] = text.get_rotation()
     style['zorder'] = text.get_zorder()
     return style
@@ -213,6 +215,8 @@ def get_axis_properties(axis):
     formatter = axis.get_major_formatter()
     if isinstance(formatter, ticker.NullFormatter):
         props['tickformat'] = ""
+    elif isinstance(formatter, ticker.FixedFormatter):
+        props['tickformat'] = list(formatter.seq)
     elif not any(label.get_visible() for label in axis.get_ticklabels()):
         props['tickformat'] = ""
     else:
@@ -231,13 +235,16 @@ def get_axis_properties(axis):
     # Get associated grid
     props['grid'] = get_grid_style(axis)
 
+    # get axis visibility
+    props['visible'] = axis.get_visible()
+
     return props
 
 
 def get_grid_style(axis):
     gridlines = axis.get_gridlines()
     if axis._gridOnMajor and len(gridlines) > 0:
-        color = color_to_hex(gridlines[0].get_color())
+        color = export_color(gridlines[0].get_color())
         alpha = gridlines[0].get_alpha()
         dasharray = get_dasharray(gridlines[0])
         return dict(gridOn=True,
@@ -245,7 +252,7 @@ def get_grid_style(axis):
                     dasharray=dasharray,
                     alpha=alpha)
     else:
-        return {"gridOn":False}
+        return {"gridOn": False}
 
 
 def get_figure_properties(fig):
@@ -255,12 +262,13 @@ def get_figure_properties(fig):
 
 
 def get_axes_properties(ax):
-    props = {'axesbg': color_to_hex(ax.patch.get_facecolor()),
+    props = {'axesbg': export_color(ax.patch.get_facecolor()),
              'axesbgalpha': ax.patch.get_alpha(),
              'bounds': ax.get_position().bounds,
              'dynamic': ax.get_navigate(),
              'axison': ax.axison,
              'frame_on': ax.get_frame_on(),
+             'patch_visible':ax.patch.get_visible(),
              'axes': [get_axis_properties(ax.xaxis),
                       get_axis_properties(ax.yaxis)]}
 
@@ -293,7 +301,7 @@ def get_axes_properties(ax):
 
         if scale not in ['date', 'linear', 'log']:
             raise ValueError("Unknown axis scale: "
-                             "{0}".format(axis[axname].get_scale()))
+                             "{0}".format(axis.get_scale()))
 
         props[axname + 'scale'] = scale
         props[axname + 'lim'] = lim
@@ -324,7 +332,7 @@ def get_legend_properties(ax, legend):
     handles, labels = ax.get_legend_handles_labels()
     visible = legend.get_visible()
     return {'handles': handles, 'labels': labels, 'visible': visible}
-    
+
 
 def image_to_base64(image):
     """


Test patch:
diff --git a/plotly/matplotlylib/mplexporter/tests/__init__.py b/plotly/matplotlylib/mplexporter/tests/__init__.py
--- a/plotly/matplotlylib/mplexporter/tests/__init__.py
+++ b/plotly/matplotlylib/mplexporter/tests/__init__.py
@@ -0,0 +1,3 @@
+import matplotlib
+matplotlib.use('Agg')
+import matplotlib.pyplot as plt
diff --git a/plotly/matplotlylib/mplexporter/tests/test_basic.py b/plotly/matplotlylib/mplexporter/tests/test_basic.py
--- a/plotly/matplotlylib/mplexporter/tests/test_basic.py
+++ b/plotly/matplotlylib/mplexporter/tests/test_basic.py
@@ -1,13 +1,13 @@
-from ..exporter import Exporter
-from ..renderers import FakeRenderer, FullFakeRenderer
-
 import matplotlib
-matplotlib.use('Agg')
-import matplotlib.pyplot as plt
-
 import numpy as np
+from distutils.version import LooseVersion
+from nose.plugins.skip import SkipTest
 from numpy.testing import assert_warns
 
+from ..exporter import Exporter
+from ..renderers import FakeRenderer, FullFakeRenderer
+from . import plt
+
 
 def fake_renderer_output(fig, Renderer):
     renderer = Renderer()
@@ -128,6 +128,23 @@ def test_path():
                          closing figure
                          """)
 
+def test_Figure():
+    """ if the fig is not associated with a canvas, FakeRenderer shall
+    not fail. """
+    fig = plt.Figure()
+    ax = fig.add_subplot(111)
+    ax.add_patch(plt.Circle((0, 0), 1))
+    ax.add_patch(plt.Rectangle((0, 0), 1, 2))
+
+    _assert_output_equal(fake_renderer_output(fig, FakeRenderer),
+                         """
+                         opening figure
+                         opening axes
+                         draw path with 25 vertices
+                         draw path with 4 vertices
+                         closing axes
+                         closing figure
+                         """)
 
 def test_multiaxes():
     fig, ax = plt.subplots(2)
@@ -148,16 +165,19 @@ def test_multiaxes():
 
 
 def test_image():
+    # Test fails for matplotlib 1.5+ because the size of the image
+    # generated by matplotlib has changed.
+    if LooseVersion(matplotlib.__version__) >= LooseVersion('1.5.0'):
+        raise SkipTest("Test fails for matplotlib version > 1.5.0");
     np.random.seed(0)  # image size depends on the seed
-    fig, ax = plt.subplots()
+    fig, ax = plt.subplots(figsize=(2, 2))
     ax.imshow(np.random.random((10, 10)),
               cmap=plt.cm.jet, interpolation='nearest')
-
     _assert_output_equal(fake_renderer_output(fig, FakeRenderer),
                          """
                          opening figure
                          opening axes
-                         draw image of size 2848
+                         draw image of size 1240 
                          closing axes
                          closing figure
                          """)
@@ -165,7 +185,7 @@ def test_image():
 
 def test_legend():
     fig, ax = plt.subplots()
-    ax.plot([1,2,3], label='label')
+    ax.plot([1, 2, 3], label='label')
     ax.legend().set_visible(False)
     _assert_output_equal(fake_renderer_output(fig, FakeRenderer),
                          """
@@ -178,10 +198,11 @@ def test_legend():
                          closing figure
                          """)
 
+
 def test_legend_dots():
     fig, ax = plt.subplots()
-    ax.plot([1,2,3], label='label')
-    ax.plot([2,2,2], 'o', label='dots')
+    ax.plot([1, 2, 3], label='label')
+    ax.plot([2, 2, 2], 'o', label='dots')
     ax.legend().set_visible(True)
     _assert_output_equal(fake_renderer_output(fig, FullFakeRenderer),
                          """
@@ -194,14 +215,14 @@ def test_legend_dots():
                          draw text 'label' None
                          draw 2 markers
                          draw text 'dots' None
-                         draw path with 5 vertices
+                         draw path with 4 vertices
                          closing legend
                          closing axes
                          closing figure
                          """)
 
+
 def test_blended():
     fig, ax = plt.subplots()
     ax.axvline(0)
-    assert_warns(UserWarning, fake_renderer_output, fig, FakeRenderer)
-    
+    #assert_warns(UserWarning, fake_renderer_output, fig, FakeRenderer)
diff --git a/plotly/matplotlylib/mplexporter/tests/test_utils.py b/plotly/matplotlylib/mplexporter/tests/test_utils.py
--- a/plotly/matplotlylib/mplexporter/tests/test_utils.py
+++ b/plotly/matplotlylib/mplexporter/tests/test_utils.py
@@ -1,5 +1,5 @@
 from numpy.testing import assert_allclose, assert_equal
-import matplotlib.pyplot as plt
+from . import plt
 from .. import utils
 
 
@@ -9,3 +9,26 @@ def test_path_data():
 
     assert_allclose(vertices.shape, (25, 2))
     assert_equal(codes, ['M', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'Z'])
+
+
+def test_linestyle():
+    linestyles = {'solid': 'none', '-': 'none',
+                  'dashed': '6,6', '--': '6,6',
+                  'dotted': '2,2', ':': '2,2',
+                  'dashdot': '4,4,2,4', '-.': '4,4,2,4',
+                  '': None, 'None': None}
+
+    for ls, result in linestyles.items():
+        line, = plt.plot([1, 2, 3], linestyle=ls)
+        assert_equal(utils.get_dasharray(line), result)
+
+
+def test_axis_w_fixed_formatter():
+    positions, labels = [0, 1, 10], ['A','B','C']
+
+    plt.xticks(positions, labels)
+    props = utils.get_axis_properties(plt.gca().xaxis)
+
+    assert_equal(props['tickvalues'], positions)
+    assert_equal(props['tickformat'], labels)
+
diff --git a/plotly/tests/test_optional/__init__.py b/plotly/tests/test_optional/__init__.py
--- a/plotly/tests/test_optional/__init__.py
+++ b/plotly/tests/test_optional/__init__.py
@@ -1 +1,6 @@
-
+try:
+    # Set matplotlib backend once here
+    import matplotlib
+    matplotlib.use('Agg')
+except:
+    pass
diff --git a/plotly/tests/test_optional/test_matplotlylib/data/bars.py b/plotly/tests/test_optional/test_matplotlylib/data/bars.py
--- a/plotly/tests/test_optional/test_matplotlylib/data/bars.py
+++ b/plotly/tests/test_optional/test_matplotlylib/data/bars.py
@@ -155,7 +155,7 @@
                 line=dict(
                     width=1.0
                 ),
-                color='#008000'
+                color='rgba(0, 128, 0, 0.5)'
             ),
             opacity=0.5,
             xaxis='x1',
@@ -169,7 +169,7 @@
                 line=dict(
                     width=1.0
                 ),
-                color='#FF0000'
+                color='rgba(255, 0, 0, 0.5)'
             ),
             opacity=0.5,
             xaxis='x1',
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_annotations.py b/plotly/tests/test_optional/test_matplotlylib/test_annotations.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_annotations.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_annotations.py
@@ -7,9 +7,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
     from plotly.tests.utils import compare_dict, strip_dict_params
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py b/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_axis_scales.py
@@ -10,9 +10,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
 
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_bars.py b/plotly/tests/test_optional/test_matplotlylib/test_bars.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_bars.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_bars.py
@@ -10,9 +10,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
 
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_data.py b/plotly/tests/test_optional/test_matplotlylib/test_data.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_data.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_data.py
@@ -9,10 +9,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
 
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_date_times.py b/plotly/tests/test_optional/test_matplotlylib/test_date_times.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_date_times.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_date_times.py
@@ -13,10 +13,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     from matplotlib.dates import date2num
     import matplotlib.pyplot as plt
 
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_lines.py b/plotly/tests/test_optional/test_matplotlylib/test_lines.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_lines.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_lines.py
@@ -10,10 +10,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
 
diff --git a/plotly/tests/test_optional/test_plotly/test_plot_mpl.py b/plotly/tests/test_optional/test_matplotlylib/test_plot_mpl.py
similarity index 93%
rename from plotly/tests/test_optional/test_plotly/test_plot_mpl.py
rename to plotly/tests/test_optional/test_matplotlylib/test_plot_mpl.py
--- a/plotly/tests/test_optional/test_plotly/test_plot_mpl.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_plot_mpl.py
@@ -17,10 +17,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
 
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_scatter.py b/plotly/tests/test_optional/test_matplotlylib/test_scatter.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_scatter.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_scatter.py
@@ -10,10 +10,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     import matplotlib.pyplot as plt
 
 
diff --git a/plotly/tests/test_optional/test_matplotlylib/test_subplots.py b/plotly/tests/test_optional/test_matplotlylib/test_subplots.py
--- a/plotly/tests/test_optional/test_matplotlylib/test_subplots.py
+++ b/plotly/tests/test_optional/test_matplotlylib/test_subplots.py
@@ -10,10 +10,6 @@
 matplotlylib = optional_imports.get_module('plotly.matplotlylib')
 
 if matplotlylib:
-    import matplotlib
-
-    # Force matplotlib to not use any Xwindows backend.
-    matplotlib.use('Agg')
     from matplotlib.gridspec import GridSpec
     import matplotlib.pyplot as plt
 
diff --git a/plotly/tests/test_optional/test_plotly/__init__.py b/plotly/tests/test_optional/test_plotly/__init__.py
deleted file mode 100644
--- a/plotly/tests/test_optional/test_plotly/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import warnings
-
-def setup_package():
-    warnings.filterwarnings('ignore')