'Matplotlib' Has No Attribute 'Cm' When Deploying an App
I'm Trying to Deploy an App Developed Using Dash Which Use Some Matplotlib Functions. When I Run Locally the Application, It Runs Smoothly and Everything Is...
I'm trying to deploy an app developed using Dash which use some matplotlib functions. When I run locally the application, it runs smoothly and everything is okay, however, when I deploy it using the same code (I'm deploying using heroku) the matplotlib version that is installed (which is the current 2.2.3) no longer find the attrbute 'cm' to create a colormap.
import matplotlib
cmap = matplotlib.cm.get_cmap('Reds')
Actual Outcome
Matplotlib version
I'm using Windows 10, with matplotlib 2.2.3 locally and in the deploy and, locally, my Python version is 3.6.6.
Thank you!
Kind regards, Renan
2 Answers
You need to import matplotlib.cm for this to work.
import matplotlib.cm
cmap = matplotlib.cm.get_cmap('Reds')
Try:
import matplotlib.pyplot as plt
cmap = plt.cm.get_cmap('Reds')