Skip to content

Cant save figures to files #700

@Rudra-J

Description

@Rudra-J

Problem Description

I am unable to save these pyfolio plots to files locally on my pc

def fig2img(self,fig):
        buf = io.BytesIO()
        fig.savefig(buf)
        buf.seek(0)
        img = Image.open(buf)
        return img

Please provide the full traceback:

plt.figure(figsize=(15, 6))
fig=pyfolio.plot_rolling_sharpe(pnl_df_eod['returns'])
img = self.fig2img(fig)
ppath=os.path.join(path,'rolling_sharpe.png')
img.save(ppath)

Please provide any additional information below:
The error that is displayed is {'Axes' object has no attribute 'savefig'}

Versions

  • Pyfolio version:
  • Python version:
  • Pandas version:
  • Matplotlib version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions