diff --git a/plotly/matplotlylib/renderer.py b/plotly/matplotlylib/renderer.py index d55f86ef3c..275ac889b7 100644 --- a/plotly/matplotlylib/renderer.py +++ b/plotly/matplotlylib/renderer.py @@ -154,10 +154,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( diff --git a/plotly/matplotlylib/tests/test_renderer.py b/plotly/matplotlylib/tests/test_renderer.py index 0d63e4815b..6ba385d8c4 100644 --- a/plotly/matplotlylib/tests/test_renderer.py +++ b/plotly/matplotlylib/tests/test_renderer.py @@ -84,3 +84,14 @@ def test_multiple_traces_native_legend(): assert plotly_fig.data[0].mode == "lines" assert plotly_fig.data[1].mode == "markers" assert plotly_fig.data[2].mode == "lines+markers" + + + +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"