Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant save figures to files #700

Open
Rudra-J opened this issue Jul 4, 2023 · 0 comments
Open

Cant save figures to files #700

Rudra-J opened this issue Jul 4, 2023 · 0 comments

Comments

@Rudra-J
Copy link

Rudra-J commented Jul 4, 2023

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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant