Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Increasing the font-size of the graphs produced by Alphalens

Hi,

How do you increase the font-size of the titles and axis labels of the graphs produced by alphalens?

Thanks,

Jack

6 responses

In the current version of Alphalens you can do something like this:

with alphalens.plotting.plotting_context(font_scale=2.5):  
    alphalens.tears.create_returns_tear_sheet(factor_data, set_context=False)  

As Alphalens on Quantopian is a little bit old version it might not work. Let me know.

If it works, you can have a look at these functions for more details:
- plotting.customize
- plotting.plotting_context
- plotting.axes_style

EDIT: some backgorund information http://seaborn.pydata.org/tutorial/aesthetics.html

Thanks for your reply Luca.

Unfortunately it doesn't work in Quantopian's research environment. I get a "security violation" error.

Is there anything else I could do?

Try this:

import seaborn as sns

with sns.plotting_context(context='notebook', font_scale=2.5):  
    alphalens.tears.create_returns_tear_sheet(factor_data, set_context=False)  

You get a "security violation" error when Quantopian hasn't given access to certain module functionalities. Letting users running arbitrary code is a challenge from security point a view, so Quantopian gives access only to functionalities that have been reviewed and considered safe.

The last suggest (of setting the context directly with a Seaborn command) worked for me, in the since that I quit getting the "security violation" error mentioned above by Jack Dry (original author of this thread), but it did not actually make the fonts any bigger!!

I have a vision problem and find reading the labels on Alphalens charts extremely difficult.

In experiments outside the Quantopian research, in a Jupyter notebook, I found that the only method capable of changing font size in plot labels was set_context , but any attempt to use it within the Quantopian research environment produces the following error:

AttributeError: __exit__  

@John Strong -

Did you try with alphalens.tears.create_returns_tear_sheet or alphalens.tears.create_full_tear_sheet? I believe it works only with the former.
The code upstream has received many bug fixes and when Quantopian updates the library this issue should be fixed, unless there is something Quantopian specific happening here.