0

Following this simple example, I am trying to make a dirt simple bar chart using yhat's ggplot python module. Here is the code suggested previously on StackOverflow:

In [1]:
from ggplot import *
import pandas as pd
df = pd.DataFrame({"x":[1,2,3,4], "y":[1,3,4,2]})
ggplot(aes(x="x", weight="y"), df) + geom_bar()

But I get an error:

Out[1]:
<repr(<ggplot.ggplot.ggplot at 0x104b18ad0>) failed: UnboundLocalError: local variable 'ax' referenced before assignment>
Community
  • 1
  • 1
Anton
  • 4,765
  • 12
  • 36
  • 50
  • The thing about python-ggplot is it's still quite early in development. You can try upgrading to the latest version, which does seem to output something resembling a bar chart, but it still doesn't seem quite right. – Marius Aug 15 '14 at 23:16

1 Answers1

0

This works a newer version of ggplot-python. It's not that pretty (x-axis labels), we really have to work on that :-(

Jan Katins
  • 2,219
  • 1
  • 25
  • 35