Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Run ruff format
  • Loading branch information
robertoffmoura committed Aug 12, 2025
commit 001ff5347c36bfd0d077234ac29f37d52c3ed77d
4 changes: 2 additions & 2 deletions plotly/matplotlylib/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,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:
Expand Down Expand Up @@ -505,7 +505,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
Expand Down
21 changes: 11 additions & 10 deletions plotly/matplotlylib/tests/test_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

from . import plt


def test_axis_mirror_with_spines_and_ticks():
"""Test that mirror=True when both spines and ticks are visible on both sides."""
fig, ax = plt.subplots()
ax.plot([0, 1], [0, 1])

# Show all spines
ax.spines['top'].set_visible(True)
ax.spines['bottom'].set_visible(True)
ax.spines['left'].set_visible(True)
ax.spines['right'].set_visible(True)
ax.spines["top"].set_visible(True)
ax.spines["bottom"].set_visible(True)
ax.spines["left"].set_visible(True)
ax.spines["right"].set_visible(True)

# Show ticks on all sides
ax.tick_params(top=True, bottom=True, left=True, right=True)
Expand All @@ -28,8 +29,8 @@ def test_axis_mirror_with_ticks_only():
ax.plot([0, 1], [0, 1])

# Hide opposite spines
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)

# Show ticks on all sides
ax.tick_params(top=True, bottom=True, left=True, right=True)
Expand Down Expand Up @@ -61,13 +62,13 @@ def test_axis_mirror_mixed_configurations():
ax.plot([0, 1], [0, 1])

# X-axis: spines and ticks on both sides (mirror="ticks")
ax.spines['top'].set_visible(True)
ax.spines['bottom'].set_visible(True)
ax.spines["top"].set_visible(True)
ax.spines["bottom"].set_visible(True)
ax.tick_params(top=True, bottom=True)

# Y-axis: spine only on one side (mirror=False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(True)
ax.spines["right"].set_visible(False)
ax.spines["left"].set_visible(True)
ax.tick_params(left=True, right=True)

plotly_fig = tls.mpl_to_plotly(fig)
Expand Down