geom_hist() в Python ggplot

Я пытаюсь воспроизвести учебные примеры для Python ggplot, который я установил с помощью pip install ggplot, это с веб-сайта yhat здесь http://blog.yhathq.com/posts/ggplot-for-python.html:

import pandas as pd
from ggplot import *

meat_lng = pd.melt(meat, id_vars=['date'])

p = ggplot(aes(x='date', y='value'), data=meat_lng)
p + geom_point() + \
    stat_smooth(colour="red") + \
    facet_wrap("variable")

p + geom_hist() + facet_wrap("color")

p = ggplot(diamonds, aes(x='price'))
p + geom_density() + \
    facet_grid("cut", "clarity")

p = ggplot(diamonds, aes(x='carat', y='price'))
p + geom_point(alpha=0.25) + \
    facet_grid("cut", "clarity")

И я получаю:

NameError                                 Traceback (most recent call last)
<ipython-input-15-41e6a9d7443f> in <module>()
      5 p + geom_point() +     stat_smooth(colour="red") +     facet_wrap("variable")
      6 
----> 7 p + geom_hist() + facet_wrap("color")
      8 
      9 p = ggplot(diamonds, aes(x='price'))

NameError: name 'geom_hist' is not defined

person Arman    schedule 17.08.2014    source источник


Ответы (1)


geom_hist() был переименован в geom_histogram(). См. здесь: http://ggplot.yhathq.com/docs/geom_histogram.html

person Community    schedule 17.08.2014