quantopian / alphalens

Performance analysis of predictive (alpha) stock factors
http://quantopian.github.io/alphalens
Apache License 2.0
3.18k stars 1.12k forks source link

Unreadable tear sheet #369

Open Boubside opened 4 years ago

Boubside commented 4 years ago

Unreadable tear sheets

I have an issue when running alphalens on my computer and not on Quantopian (because I want to use Tensorflow) and not in a notebook. When i'm trying to plot a tear sheet by using for example :

alphalens.tears.create_returns_tear_sheet(factor_data)

I get a totally unreadable figure because there is to much plot in a single figure : https://pasteboard.co/J42nAB2.png

So I need to basically rewrite the tear module to be able to plot or save each figure individually . It would be nice to be able to provide axes to plot on to the tear module methods as it is possible for the plotting module. Or maybe the tears methods could returns an axes/figure list and not show the plots by themselves so we have the option to show or save the separate figures.

EDIT:

By searching in the plotting module, I found the plotting_context() method, maybe this could help ?

Versions

luca-s commented 4 years ago

Does this help?

Boubside commented 4 years ago

@luca-s Yes it did, I can now save the figure. There is still some source modification to be able to easily configure the save path and name directly from the tears methods but it will work. Thanks !

It would still be nice to have this feature embedded in Alphalens, but I think my use case is not the most common one :)

Boubside commented 4 years ago

I modified the tears module to be able to save the tear sheets instead of plotting them. I think it might be useful to someone so I'd like to contribute, but as my first contribution on Github, I don't know how this things works...