Skip to content

Commit 20ec3bd

Browse files
committed
completely removed deprecated messages in matplotlylib
1 parent e8de1c6 commit 20ec3bd

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

plotly/matplotlylib/renderer.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,12 @@ def open_axes(self, ax, props):
178178
self.plotly_fig['layout']['yaxis{0}'.format(self.axis_ct)] = yaxis
179179

180180
# let all subsequent dates be handled properly if required
181-
if xaxis.get('type') == 'date':
181+
182+
try:
183+
xaxis['type'] == 'date'
182184
self.x_is_mpl_date = True
185+
except KeyError:
186+
pass
183187

184188
def close_axes(self, ax):
185189
"""Close the axes object and clean up.
@@ -283,9 +287,9 @@ def draw_bar(self, coll):
283287
xaxis='x{0}'.format(self.axis_ct),
284288
yaxis='y{0}'.format(self.axis_ct),
285289
opacity=trace[0]['alpha'], # TODO: get all alphas if array?
286-
marker=go.Marker(
290+
marker=go.bar.Marker(
287291
color=trace[0]['facecolor'], # TODO: get all
288-
line=go.Line(width=trace[0]['edgewidth']))) # TODO ditto
292+
line=dict(width=trace[0]['edgewidth']))) # TODO ditto
289293
if len(bar['x']) > 1:
290294
self.msg += " Heck yeah, I drew that bar chart\n"
291295
self.plotly_fig.add_trace(bar),
@@ -346,18 +350,18 @@ def draw_marked_line(self, **props):
346350
props['linestyle']['alpha'])
347351

348352
#print(mpltools.convert_dash(props['linestyle']['dasharray']))
349-
line = go.Line(
353+
line = go.scatter.Line(
350354
color=color,
351355
width=props['linestyle']['linewidth'],
352356
dash=mpltools.convert_dash(props['linestyle']['dasharray'])
353357
)
354358
if props['markerstyle']:
355-
marker = go.Marker(
359+
marker = go.scatter.Marker(
356360
opacity=props['markerstyle']['alpha'],
357361
color=props['markerstyle']['facecolor'],
358362
symbol=mpltools.convert_symbol(props['markerstyle']['marker']),
359363
size=props['markerstyle']['markersize'],
360-
line=go.Line(
364+
line=dict(
361365
color=props['markerstyle']['edgecolor'],
362366
width=props['markerstyle']['edgewidth']
363367
)
@@ -587,7 +591,7 @@ def draw_text(self, **props):
587591
xanchor=xanchor,
588592
yanchor=yanchor,
589593
showarrow=False, # change this later?
590-
font=go.Font(
594+
font=go.layout.annotation.Font(
591595
color=props['style']['color'],
592596
size=props['style']['fontsize']
593597
)
@@ -631,7 +635,7 @@ def draw_title(self, **props):
631635
self.plotly_fig['layout'])
632636
annotation = go.Annotation(
633637
text=props['text'],
634-
font=go.Font(
638+
font=go.layout.annotation.Font(
635639
color=props['style']['color'],
636640
size=props['style']['fontsize']
637641
),
@@ -648,7 +652,7 @@ def draw_title(self, **props):
648652
self.msg += " Only one subplot found, adding as a " \
649653
"plotly title\n"
650654
self.plotly_fig['layout']['title'] = props['text']
651-
titlefont = go.Font(
655+
titlefont = dict(
652656
size=props['style']['fontsize'],
653657
color=props['style']['color']
654658
)
@@ -680,7 +684,7 @@ def draw_xlabel(self, **props):
680684
self.msg += " Adding xlabel\n"
681685
axis_key = 'xaxis{0}'.format(self.axis_ct)
682686
self.plotly_fig['layout'][axis_key]['title'] = str(props['text'])
683-
titlefont = go.Font(
687+
titlefont = dict(
684688
size=props['style']['fontsize'],
685689
color=props['style']['color'])
686690
self.plotly_fig['layout'][axis_key]['titlefont'] = titlefont
@@ -711,7 +715,7 @@ def draw_ylabel(self, **props):
711715
self.msg += " Adding ylabel\n"
712716
axis_key = 'yaxis{0}'.format(self.axis_ct)
713717
self.plotly_fig['layout'][axis_key]['title'] = props['text']
714-
titlefont = go.Font(
718+
titlefont = dict(
715719
size=props['style']['fontsize'],
716720
color=props['style']['color'])
717721
self.plotly_fig['layout'][axis_key]['titlefont'] = titlefont

0 commit comments

Comments
 (0)