1
votes

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.

1
... why on earth are you linking to a dropbox file instead of including the image in the question? Use the button at the right of {} to insert an image. If the image is too big you can change the URL by adding an s at the end to obtain a small imag (m for medium) (e.g. .../123456.png becomes .../123456s.png) - Bakuriu
Have you tried inlining your figures in Jupyter using %matplotlib inline? - jhoepken
Thanks Jens, you're right. I forgot to add %matplotlib inline, and it works now. Thanks also for the edit. Can you add this comment as an answer so I can validate it? - htaidirt
I'm glad that this worked for you. Good luck with your work! - jhoepken

1 Answers

1
votes

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