Hassen
Hassen

Reputation: 7664

Getting black graph when using Matplotlib in my Python notebook

I'm testing different visualization tools from my python Jupyter Notebook, based on the following blog post comparison http://pbpython.com/visualization-tools-1.html

First, I import libraries and check versions:

import pandas as pd
import matplotlib

print "Pandas version: " + pd.__version__
print "Matplotlib version: " + matplotlib.__version__

Which prints:

Pandas version: 0.17.1
Matplotlib version: 1.5.1

Then, I load the data from the CSV file (located at https://dl.dropboxusercontent.com/u/2439854/tmp/mn-budget-detail-2014.csv):

budget_full = pd.read_csv('https://dl.dropboxusercontent.com/u/2439854/tmp/mn-budget-detail-2014.csv')
budget = budget_full.sort_values(by = 'amount', ascending = False)[:10]

Finally, I plot the data:

matplotlib.style.use('ggplot')

budget_plot = budget.plot(kind = "bar", x = budget["detail"],
                      title = "MN Capital Budget - 2014",
                      legend = False)

Unfortunately, this produces a little black figure

enter image description here

My Python version is:

Python 2.7.11 :: Continuum Analytics, Inc.

I'm on a Mac OSX (El Capitan) and I'm managing my python environment using Anaconda Continuum Analytics.

Thanks for your help.

Upvotes: 1

Views: 86

Answers (1)

jhoepken
jhoepken

Reputation: 1858

Have you tried inlining your figures in Jupyter using %matplotlib inline?

Upvotes: 1

Related Questions