diff --git a/plotly/matplotlylib/renderer.py b/plotly/matplotlylib/renderer.py index c95de52247..63a5fda17f 100644 --- a/plotly/matplotlylib/renderer.py +++ b/plotly/matplotlylib/renderer.py @@ -153,10 +153,16 @@ def open_axes(self, ax, props): self.axis_ct += 1 # set defaults in axes xaxis = go.layout.XAxis( - anchor="y{0}".format(self.axis_ct), zeroline=False, ticks="inside" + anchor="y{0}".format(self.axis_ct), + zeroline=False, + ticks="inside", + linecolor="black", ) yaxis = go.layout.YAxis( - anchor="x{0}".format(self.axis_ct), zeroline=False, ticks="inside" + anchor="x{0}".format(self.axis_ct), + zeroline=False, + ticks="inside", + linecolor="black", ) # update defaults with things set in mpl mpl_xaxis, mpl_yaxis = mpltools.prep_xy_axis( @@ -299,7 +305,7 @@ def draw_bar(self, coll): ) # TODO ditto if len(bar["x"]) > 1: self.msg += " Heck yeah, I drew that bar chart\n" - (self.plotly_fig.add_trace(bar),) + self.plotly_fig.add_trace(bar) if bar_gap is not None: self.plotly_fig["layout"]["bargap"] = bar_gap else: @@ -497,7 +503,7 @@ def draw_marked_line(self, **props): marked_line["x"] = mpltools.mpl_dates_to_datestrings( marked_line["x"], formatter ) - (self.plotly_fig.add_trace(marked_line),) + self.plotly_fig.add_trace(marked_line) self.msg += " Heck yeah, I drew that line\n" elif props["coordinates"] == "axes": # dealing with legend graphical elements diff --git a/plotly/matplotlylib/tests/__init__.py b/plotly/matplotlylib/tests/__init__.py new file mode 100644 index 0000000000..c29e9896d6 --- /dev/null +++ b/plotly/matplotlylib/tests/__init__.py @@ -0,0 +1,4 @@ +import matplotlib + +matplotlib.use("Agg") +import matplotlib.pyplot as plt diff --git a/plotly/matplotlylib/tests/test_renderer.py b/plotly/matplotlylib/tests/test_renderer.py new file mode 100644 index 0000000000..fe0ebae919 --- /dev/null +++ b/plotly/matplotlylib/tests/test_renderer.py @@ -0,0 +1,13 @@ +import plotly.tools as tls + +from . import plt + + +def test_axis_linecolor_defaults_to_black(): + fig, ax = plt.subplots() + ax.plot([0, 1], [0, 1]) + + plotly_fig = tls.mpl_to_plotly(fig) + + assert plotly_fig.layout.xaxis.linecolor == "black" + assert plotly_fig.layout.yaxis.linecolor == "black"