1

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.

4
  • 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) Commented Mar 12, 2016 at 8:08
  • Have you tried inlining your figures in Jupyter using %matplotlib inline? Commented Mar 12, 2016 at 8:31
  • 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? Commented Mar 12, 2016 at 8:52
  • 1
    I'm glad that this worked for you. Good luck with your work! Commented Mar 12, 2016 at 9:51

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.