Skip to content

Commit 08b9e44

Browse files
Set axis linecolor to black by default when converting from matplotlib figure
1 parent bf29422 commit 08b9e44

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

plotly/matplotlylib/renderer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ def open_axes(self, ax, props):
154154
self.axis_ct += 1
155155
# set defaults in axes
156156
xaxis = go.layout.XAxis(
157-
anchor="y{0}".format(self.axis_ct), zeroline=False, ticks="inside"
157+
anchor="y{0}".format(self.axis_ct), zeroline=False, ticks="inside", linecolor="black"
158158
)
159159
yaxis = go.layout.YAxis(
160-
anchor="x{0}".format(self.axis_ct), zeroline=False, ticks="inside"
160+
anchor="x{0}".format(self.axis_ct), zeroline=False, ticks="inside", linecolor="black"
161161
)
162162
# update defaults with things set in mpl
163163
mpl_xaxis, mpl_yaxis = mpltools.prep_xy_axis(

plotly/matplotlylib/tests/test_renderer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,13 @@ def test_multiple_traces_native_legend():
8484
assert plotly_fig.data[0].mode == "lines"
8585
assert plotly_fig.data[1].mode == "markers"
8686
assert plotly_fig.data[2].mode == "lines+markers"
87+
88+
89+
def test_axis_linecolor_defaults_to_black():
90+
fig, ax = plt.subplots()
91+
ax.plot([0, 1], [0, 1])
92+
93+
plotly_fig = tls.mpl_to_plotly(fig)
94+
95+
assert plotly_fig.layout.xaxis.linecolor == "black"
96+
assert plotly_fig.layout.yaxis.linecolor == "black"

0 commit comments

Comments
 (0)