Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Set axis linecolor to black by default when converting from matplotlib #5311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
robertoffmoura wants to merge 2 commits into plotly:main
base: main
Choose a base branch
Loading
from robertoffmoura:rm/default-axis-linecolor-black
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions plotly/matplotlylib/renderer.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions plotly/matplotlylib/tests/test_renderer.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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"

AltStyle によって変換されたページ (->オリジナル) /