Skip to content

Commit e65619c

Browse files
Run ruff format
1 parent 753e5d5 commit e65619c

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

plotly/matplotlylib/renderer.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,16 @@ 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", linecolor="black"
156+
anchor="y{0}".format(self.axis_ct),
157+
zeroline=False,
158+
ticks="inside",
159+
linecolor="black",
157160
)
158161
yaxis = go.layout.YAxis(
159-
anchor="x{0}".format(self.axis_ct), zeroline=False, ticks="inside", linecolor="black"
162+
anchor="x{0}".format(self.axis_ct),
163+
zeroline=False,
164+
ticks="inside",
165+
linecolor="black",
160166
)
161167
# update defaults with things set in mpl
162168
mpl_xaxis, mpl_yaxis = mpltools.prep_xy_axis(
@@ -199,7 +205,6 @@ def close_axes(self, ax):
199205
self.x_is_mpl_date = False
200206

201207
def draw_bars(self, bars):
202-
203208
# sort bars according to bar containers
204209
mpl_traces = []
205210
for container in self.bar_containers:
@@ -300,7 +305,7 @@ def draw_bar(self, coll):
300305
) # TODO ditto
301306
if len(bar["x"]) > 1:
302307
self.msg += " Heck yeah, I drew that bar chart\n"
303-
self.plotly_fig.add_trace(bar),
308+
self.plotly_fig.add_trace(bar)
304309
if bar_gap is not None:
305310
self.plotly_fig["layout"]["bargap"] = bar_gap
306311
else:
@@ -498,13 +503,13 @@ def draw_marked_line(self, **props):
498503
marked_line["x"] = mpltools.mpl_dates_to_datestrings(
499504
marked_line["x"], formatter
500505
)
501-
self.plotly_fig.add_trace(marked_line),
506+
self.plotly_fig.add_trace(marked_line)
502507
self.msg += " Heck yeah, I drew that line\n"
503508
elif props["coordinates"] == "axes":
504509
# dealing with legend graphical elements
505510
self.draw_legend_shapes(mode=mode, shape=shape, **props)
506511
else:
507-
self.msg += " Line didn't have 'data' coordinates, " "not drawing\n"
512+
self.msg += " Line didn't have 'data' coordinates, not drawing\n"
508513
warnings.warn(
509514
"Bummer! Plotly can currently only draw Line2D "
510515
"objects from matplotlib that are in 'data' "
@@ -568,7 +573,7 @@ def draw_path_collection(self, **props):
568573
self.msg += " Drawing path collection as markers\n"
569574
self.draw_marked_line(**scatter_props)
570575
else:
571-
self.msg += " Path collection not linked to 'data', " "not drawing\n"
576+
self.msg += " Path collection not linked to 'data', not drawing\n"
572577
warnings.warn(
573578
"Dang! That path collection is out of this "
574579
"world. I totally don't know what to do with "
@@ -669,9 +674,7 @@ def draw_text(self, **props):
669674
else: # just a regular text annotation...
670675
self.msg += " Text object is a normal annotation\n"
671676
if props["coordinates"] != "data":
672-
self.msg += (
673-
" Text object isn't linked to 'data' " "coordinates\n"
674-
)
677+
self.msg += " Text object isn't linked to 'data' coordinates\n"
675678
x_px, y_px = (
676679
props["mplobj"].get_transform().transform(props["position"])
677680
)
@@ -681,7 +684,7 @@ def draw_text(self, **props):
681684
xanchor = props["style"]["halign"] # no difference here!
682685
yanchor = mpltools.convert_va(props["style"]["valign"])
683686
else:
684-
self.msg += " Text object is linked to 'data' " "coordinates\n"
687+
self.msg += " Text object is linked to 'data' coordinates\n"
685688
x, y = props["position"]
686689
axis_ct = self.axis_ct
687690
xaxis = self.plotly_fig["layout"]["xaxis{0}".format(axis_ct)]
@@ -757,9 +760,7 @@ def draw_title(self, **props):
757760
"""
758761
self.msg += " Attempting to draw a title\n"
759762
if len(self.mpl_fig.axes) > 1:
760-
self.msg += (
761-
" More than one subplot, adding title as " "annotation\n"
762-
)
763+
self.msg += " More than one subplot, adding title as annotation\n"
763764
x_px, y_px = props["mplobj"].get_transform().transform(props["position"])
764765
x, y = mpltools.display_to_paper(x_px, y_px, self.plotly_fig["layout"])
765766
annotation = go.layout.Annotation(
@@ -777,9 +778,7 @@ def draw_title(self, **props):
777778
)
778779
self.plotly_fig["layout"]["annotations"] += (annotation,)
779780
else:
780-
self.msg += (
781-
" Only one subplot found, adding as a " "plotly title\n"
782-
)
781+
self.msg += " Only one subplot found, adding as a plotly title\n"
783782
self.plotly_fig["layout"]["title"] = props["text"]
784783
title_font = dict(
785784
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_axis_linecolor_defaults_to_black():
67
fig, ax = plt.subplots()
78
ax.plot([0, 1], [0, 1])

0 commit comments

Comments
 (0)