Skip to content

Commit 373d9e7

Browse files
Run ruff format
1 parent c368e89 commit 373d9e7

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

plotly/matplotlylib/renderer.py

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

202202
def draw_bars(self, bars):
203-
204203
# sort bars according to bar containers
205204
mpl_traces = []
206205
for container in self.bar_containers:
@@ -301,7 +300,7 @@ def draw_bar(self, coll):
301300
) # TODO ditto
302301
if len(bar["x"]) > 1:
303302
self.msg += " Heck yeah, I drew that bar chart\n"
304-
self.plotly_fig.add_trace(bar),
303+
self.plotly_fig.add_trace(bar)
305304
if bar_gap is not None:
306305
self.plotly_fig["layout"]["bargap"] = bar_gap
307306
else:
@@ -499,13 +498,13 @@ def draw_marked_line(self, **props):
499498
marked_line["x"] = mpltools.mpl_dates_to_datestrings(
500499
marked_line["x"], formatter
501500
)
502-
self.plotly_fig.add_trace(marked_line),
501+
self.plotly_fig.add_trace(marked_line)
503502
self.msg += " Heck yeah, I drew that line\n"
504503
elif props["coordinates"] == "axes":
505504
# dealing with legend graphical elements
506505
self.draw_legend_shapes(mode=mode, shape=shape, **props)
507506
else:
508-
self.msg += " Line didn't have 'data' coordinates, " "not drawing\n"
507+
self.msg += " Line didn't have 'data' coordinates, not drawing\n"
509508
warnings.warn(
510509
"Bummer! Plotly can currently only draw Line2D "
511510
"objects from matplotlib that are in 'data' "
@@ -569,7 +568,7 @@ def draw_path_collection(self, **props):
569568
self.msg += " Drawing path collection as markers\n"
570569
self.draw_marked_line(**scatter_props)
571570
else:
572-
self.msg += " Path collection not linked to 'data', " "not drawing\n"
571+
self.msg += " Path collection not linked to 'data', not drawing\n"
573572
warnings.warn(
574573
"Dang! That path collection is out of this "
575574
"world. I totally don't know what to do with "
@@ -670,9 +669,7 @@ def draw_text(self, **props):
670669
else: # just a regular text annotation...
671670
self.msg += " Text object is a normal annotation\n"
672671
if props["coordinates"] != "data":
673-
self.msg += (
674-
" Text object isn't linked to 'data' " "coordinates\n"
675-
)
672+
self.msg += " Text object isn't linked to 'data' coordinates\n"
676673
x_px, y_px = (
677674
props["mplobj"].get_transform().transform(props["position"])
678675
)
@@ -682,7 +679,7 @@ def draw_text(self, **props):
682679
xanchor = props["style"]["halign"] # no difference here!
683680
yanchor = mpltools.convert_va(props["style"]["valign"])
684681
else:
685-
self.msg += " Text object is linked to 'data' " "coordinates\n"
682+
self.msg += " Text object is linked to 'data' coordinates\n"
686683
x, y = props["position"]
687684
axis_ct = self.axis_ct
688685
xaxis = self.plotly_fig["layout"]["xaxis{0}".format(axis_ct)]
@@ -758,9 +755,7 @@ def draw_title(self, **props):
758755
"""
759756
self.msg += " Attempting to draw a title\n"
760757
if len(self.mpl_fig.axes) > 1:
761-
self.msg += (
762-
" More than one subplot, adding title as " "annotation\n"
763-
)
758+
self.msg += " More than one subplot, adding title as annotation\n"
764759
x_px, y_px = props["mplobj"].get_transform().transform(props["position"])
765760
x, y = mpltools.display_to_paper(x_px, y_px, self.plotly_fig["layout"])
766761
annotation = go.layout.Annotation(
@@ -778,9 +773,7 @@ def draw_title(self, **props):
778773
)
779774
self.plotly_fig["layout"]["annotations"] += (annotation,)
780775
else:
781-
self.msg += (
782-
" Only one subplot found, adding as a " "plotly title\n"
783-
)
776+
self.msg += " Only one subplot found, adding as a plotly title\n"
784777
self.plotly_fig["layout"]["title"] = props["text"]
785778
title_font = dict(
786779
size=props["style"]["fontsize"], color=props["style"]["color"]

plotly/matplotlylib/tests/test_renderer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from . import plt
44

5+
56
def test_plot_bgcolor_defaults_to_white():
67
plt.figure()
78
plt.plot([0, 1], [0, 1])

0 commit comments

Comments
 (0)