Skip to content

Commit 860b8b0

Browse files
Run ruff format
1 parent daf0327 commit 860b8b0

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

plotly/matplotlylib/mpltools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def prep_ticks(ax, index, ax_type, props):
490490
else:
491491
axis_dict = dict(range=None, type="linear")
492492
warnings.warn(
493-
"Converted non-base10 {0}-axis log scale to 'linear'" "".format(ax_type)
493+
"Converted non-base10 {0}-axis log scale to 'linear'".format(ax_type)
494494
)
495495
else:
496496
return dict()

plotly/matplotlylib/renderer.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def close_axes(self, ax):
207207
self.x_is_mpl_date = False
208208

209209
def draw_bars(self, bars):
210-
211210
# sort bars according to bar containers
212211
mpl_traces = []
213212
for container in self.bar_containers:
@@ -308,7 +307,7 @@ def draw_bar(self, coll):
308307
) # TODO ditto
309308
if len(bar["x"]) > 1:
310309
self.msg += " Heck yeah, I drew that bar chart\n"
311-
self.plotly_fig.add_trace(bar),
310+
self.plotly_fig.add_trace(bar)
312311
if bar_gap is not None:
313312
self.plotly_fig["layout"]["bargap"] = bar_gap
314313
else:
@@ -506,13 +505,13 @@ def draw_marked_line(self, **props):
506505
marked_line["x"] = mpltools.mpl_dates_to_datestrings(
507506
marked_line["x"], formatter
508507
)
509-
self.plotly_fig.add_trace(marked_line),
508+
self.plotly_fig.add_trace(marked_line)
510509
self.msg += " Heck yeah, I drew that line\n"
511510
elif props["coordinates"] == "axes":
512511
# dealing with legend graphical elements
513512
self.draw_legend_shapes(mode=mode, shape=shape, **props)
514513
else:
515-
self.msg += " Line didn't have 'data' coordinates, " "not drawing\n"
514+
self.msg += " Line didn't have 'data' coordinates, not drawing\n"
516515
warnings.warn(
517516
"Bummer! Plotly can currently only draw Line2D "
518517
"objects from matplotlib that are in 'data' "
@@ -576,7 +575,7 @@ def draw_path_collection(self, **props):
576575
self.msg += " Drawing path collection as markers\n"
577576
self.draw_marked_line(**scatter_props)
578577
else:
579-
self.msg += " Path collection not linked to 'data', " "not drawing\n"
578+
self.msg += " Path collection not linked to 'data', not drawing\n"
580579
warnings.warn(
581580
"Dang! That path collection is out of this "
582581
"world. I totally don't know what to do with "
@@ -677,9 +676,7 @@ def draw_text(self, **props):
677676
else: # just a regular text annotation...
678677
self.msg += " Text object is a normal annotation\n"
679678
if props["coordinates"] != "data":
680-
self.msg += (
681-
" Text object isn't linked to 'data' " "coordinates\n"
682-
)
679+
self.msg += " Text object isn't linked to 'data' coordinates\n"
683680
x_px, y_px = (
684681
props["mplobj"].get_transform().transform(props["position"])
685682
)
@@ -689,7 +686,7 @@ def draw_text(self, **props):
689686
xanchor = props["style"]["halign"] # no difference here!
690687
yanchor = mpltools.convert_va(props["style"]["valign"])
691688
else:
692-
self.msg += " Text object is linked to 'data' " "coordinates\n"
689+
self.msg += " Text object is linked to 'data' coordinates\n"
693690
x, y = props["position"]
694691
axis_ct = self.axis_ct
695692
xaxis = self.plotly_fig["layout"]["xaxis{0}".format(axis_ct)]
@@ -765,9 +762,7 @@ def draw_title(self, **props):
765762
"""
766763
self.msg += " Attempting to draw a title\n"
767764
if len(self.mpl_fig.axes) > 1:
768-
self.msg += (
769-
" More than one subplot, adding title as " "annotation\n"
770-
)
765+
self.msg += " More than one subplot, adding title as annotation\n"
771766
x_px, y_px = props["mplobj"].get_transform().transform(props["position"])
772767
x, y = mpltools.display_to_paper(x_px, y_px, self.plotly_fig["layout"])
773768
annotation = go.layout.Annotation(
@@ -785,9 +780,7 @@ def draw_title(self, **props):
785780
)
786781
self.plotly_fig["layout"]["annotations"] += (annotation,)
787782
else:
788-
self.msg += (
789-
" Only one subplot found, adding as a " "plotly title\n"
790-
)
783+
self.msg += " Only one subplot found, adding as a plotly title\n"
791784
self.plotly_fig["layout"]["title"] = props["text"]
792785
title_font = dict(
793786
size=props["style"]["fontsize"], color=props["style"]["color"]

plotly/matplotlylib/tests/test_renderer.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
from . import plt
44

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

1011
# Show all spines
11-
ax.spines['top'].set_visible(True)
12-
ax.spines['bottom'].set_visible(True)
13-
ax.spines['left'].set_visible(True)
14-
ax.spines['right'].set_visible(True)
12+
ax.spines["top"].set_visible(True)
13+
ax.spines["bottom"].set_visible(True)
14+
ax.spines["left"].set_visible(True)
15+
ax.spines["right"].set_visible(True)
1516

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

3031
# Hide opposite spines
31-
ax.spines['top'].set_visible(False)
32-
ax.spines['right'].set_visible(False)
32+
ax.spines["top"].set_visible(False)
33+
ax.spines["right"].set_visible(False)
3334

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

6364
# X-axis: spines and ticks on both sides (mirror="ticks")
64-
ax.spines['top'].set_visible(True)
65-
ax.spines['bottom'].set_visible(True)
65+
ax.spines["top"].set_visible(True)
66+
ax.spines["bottom"].set_visible(True)
6667
ax.tick_params(top=True, bottom=True)
6768

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

7374
plotly_fig = tls.mpl_to_plotly(fig)

0 commit comments

Comments
 (0)