Skip to content

Matplotlib Figure object not supporting 'validate' and 'strip_style' #1128

Closed
@priyatharsan

Description

@priyatharsan

Matplotlib Figure object is not supporting validate method

fig.validate()

Sample Code:

fig, ax = plt.subplots()
ax.plot(y0, label='y0')
ax.plot(y1, label='y1')
ax.plot(y2, label='y2')
ax.plot(capacity, label='capacity')

# set all traces' "fill" so that it fills to the next 'y' trace
update = {'data':[{'fill': 'tonexty'}]}

# strip style just lets Plotly make the styling choices (e.g., colors)
plot_url = py.iplot_mpl(fig, update=update, filename='mpl-stacked-line')

Error:

site-packages\plotly\plotly\plotly.pyc in iplot_mpl(fig, resize, strip_style, update, **plot_options)
    280     if update and isinstance(update, dict):
    281         fig.update(update)
--> 282         fig.validate()
    283     elif update is not None:
    284         raise exceptions.PlotlyGraphObjectError(

AttributeError: 'Figure' object has no attribute 'validate'

And for strip_style

def iplot_mpl(fig, resize=True, strip_style=False, update=None,

Sample Code:

plot_url = py.iplot_mpl(fig, update=update, strip_style=True, filename='mpl-stacked-line')

Error:

C:\Anaconda\Anaconda2\lib\site-packages\plotly\plotly\plotly.pyc in iplot_mpl(fig, resize, strip_style, update, **plot_options)
    277 
    278     """
--> 279     fig = tools.mpl_to_plotly(fig, resize=resize, strip_style=strip_style)
    280     if update and isinstance(update, dict):
    281         fig.update(update)

C:\Anaconda\Anaconda2\lib\site-packages\plotly\tools.pyc in mpl_to_plotly(fig, resize, strip_style, verbose)
    467             renderer.resize()
    468         if strip_style:
--> 469             renderer.strip_style()
    470         if verbose:
    471             print(renderer.msg)

C:\Anaconda\Anaconda2\lib\site-packages\plotly\matplotlylib\renderer.pyc in strip_style(self)
    737     def strip_style(self):
    738         self.msg += "Stripping mpl style, deleting keys from data and layout\n"
--> 739         self.plotly_fig.strip_style()

AttributeError: 'Figure' object has no attribute 'strip_style'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions