Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
matplotlib in Research - changing colormaps?

Anyone figured out how to do them? I keep getting Restricted/Attribute errors importing matplotlib.pyplot.cm or matplotlib.colors

5 responses

I was not able to import plt.cm or colors. Attached is my ugly attempt for plt.plot.
(for plt.imshow, I simply use cmap=plt.get_cmap('jet') )

Simon/Ted, thanks for bringing this up and putting it on our radar. We'll take a look at supporting color maps in research and will let you know once it's available.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Thanks -- someone mentioned that passing the string name of the color map works, but unlocking that namespace would be helpful!

Good news - matplotlib.cm is now available in research!

I need a colormap that is red and green at the limits of my data and black at 0.
The data limits are not symmetric to 0.
I think i have to create a matplotlib.colors.Normalize subclass to fix black at 0, and a matplotlib.colors.LinearSegmentedColormap
to make the 0 black but importing matplotlib.colors causes ImportError.
Is there a way to achieve the desired effect?

Thanks.