Skip to content

Commit 753e5d5

Browse files
Set axis linecolor to black by default when converting from matplotlib figure
1 parent 1ec864b commit 753e5d5

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

plotly/matplotlylib/renderer.py

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

plotly/matplotlylib/tests/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import matplotlib
2+
3+
matplotlib.use("Agg")
4+
import matplotlib.pyplot as plt
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import plotly.tools as tls
2+
3+
from . import plt
4+
5+
def test_axis_linecolor_defaults_to_black():
6+
fig, ax = plt.subplots()
7+
ax.plot([0, 1], [0, 1])
8+
9+
plotly_fig = tls.mpl_to_plotly(fig)
10+
11+
assert plotly_fig.layout.xaxis.linecolor == "black"
12+
assert plotly_fig.layout.yaxis.linecolor == "black"

0 commit comments

Comments
 (0)