@@ -153,10 +153,16 @@ def open_axes(self, ax, props):
153
153
self .axis_ct += 1
154
154
# set defaults in axes
155
155
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" ,
157
160
)
158
161
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" ,
160
166
)
161
167
# update defaults with things set in mpl
162
168
mpl_xaxis , mpl_yaxis = mpltools .prep_xy_axis (
@@ -199,7 +205,6 @@ def close_axes(self, ax):
199
205
self .x_is_mpl_date = False
200
206
201
207
def draw_bars (self , bars ):
202
-
203
208
# sort bars according to bar containers
204
209
mpl_traces = []
205
210
for container in self .bar_containers :
@@ -300,7 +305,7 @@ def draw_bar(self, coll):
300
305
) # TODO ditto
301
306
if len (bar ["x" ]) > 1 :
302
307
self .msg += " Heck yeah, I drew that bar chart\n "
303
- self .plotly_fig .add_trace (bar ),
308
+ self .plotly_fig .add_trace (bar )
304
309
if bar_gap is not None :
305
310
self .plotly_fig ["layout" ]["bargap" ] = bar_gap
306
311
else :
@@ -498,13 +503,13 @@ def draw_marked_line(self, **props):
498
503
marked_line ["x" ] = mpltools .mpl_dates_to_datestrings (
499
504
marked_line ["x" ], formatter
500
505
)
501
- self .plotly_fig .add_trace (marked_line ),
506
+ self .plotly_fig .add_trace (marked_line )
502
507
self .msg += " Heck yeah, I drew that line\n "
503
508
elif props ["coordinates" ] == "axes" :
504
509
# dealing with legend graphical elements
505
510
self .draw_legend_shapes (mode = mode , shape = shape , ** props )
506
511
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 "
508
513
warnings .warn (
509
514
"Bummer! Plotly can currently only draw Line2D "
510
515
"objects from matplotlib that are in 'data' "
@@ -568,7 +573,7 @@ def draw_path_collection(self, **props):
568
573
self .msg += " Drawing path collection as markers\n "
569
574
self .draw_marked_line (** scatter_props )
570
575
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 "
572
577
warnings .warn (
573
578
"Dang! That path collection is out of this "
574
579
"world. I totally don't know what to do with "
@@ -669,9 +674,7 @@ def draw_text(self, **props):
669
674
else : # just a regular text annotation...
670
675
self .msg += " Text object is a normal annotation\n "
671
676
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 "
675
678
x_px , y_px = (
676
679
props ["mplobj" ].get_transform ().transform (props ["position" ])
677
680
)
@@ -681,7 +684,7 @@ def draw_text(self, **props):
681
684
xanchor = props ["style" ]["halign" ] # no difference here!
682
685
yanchor = mpltools .convert_va (props ["style" ]["valign" ])
683
686
else :
684
- self .msg += " Text object is linked to 'data' " " coordinates\n "
687
+ self .msg += " Text object is linked to 'data' coordinates\n "
685
688
x , y = props ["position" ]
686
689
axis_ct = self .axis_ct
687
690
xaxis = self .plotly_fig ["layout" ]["xaxis{0}" .format (axis_ct )]
@@ -757,9 +760,7 @@ def draw_title(self, **props):
757
760
"""
758
761
self .msg += " Attempting to draw a title\n "
759
762
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 "
763
764
x_px , y_px = props ["mplobj" ].get_transform ().transform (props ["position" ])
764
765
x , y = mpltools .display_to_paper (x_px , y_px , self .plotly_fig ["layout" ])
765
766
annotation = go .layout .Annotation (
@@ -777,9 +778,7 @@ def draw_title(self, **props):
777
778
)
778
779
self .plotly_fig ["layout" ]["annotations" ] += (annotation ,)
779
780
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 "
783
782
self .plotly_fig ["layout" ]["title" ] = props ["text" ]
784
783
title_font = dict (
785
784
size = props ["style" ]["fontsize" ], color = props ["style" ]["color" ]
0 commit comments