-1

私はまだ iPython Notebook/Jupyter と Bokeh でプロットする方法の両方を学んでいます。ここからモデルの手順を使用しています: http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/00%20-%20intro.ipynb# しかし、私のコードは In[ 13]: 彼らの例で。Bokeh から次のように述べています。

In [13]:

from bokeh.models import Circle, HoverTool
from bokeh.palettes import Spectral6

renderer_source = ColumnDataSource(bubble_plot.get_1964_data())

def add_circles(plot):
    plot = add_text(plot)
    # Add the circle
    circle_glyph = Circle(
        x='fertility', y='life', size='population',
        fill_color='region_color', fill_alpha=0.8,
        line_color='#7c7e71', line_width=0.5, line_alpha=0.5)
    circle_renderer = plot.add_glyph(renderer_source, circle_glyph)

    # Add the hover (only against the circle and not other plot elements)
    tooltips = "@index"
    plot.add_tools(HoverTool(tooltips=tooltips, renderers=[circle_renderer]))
    return plot

show(add_circles(get_plot()))

私のコードは、最初の 2 番目のステップで失敗します。私は自分のデータを使用しているので、次のとおりです。

In [96]:

from bokeh.models import Circle, HoverTool

from bokeh.palettes import Spectral6

from bokeh.plotting import *

In [97]:

renderer_source = ColumnDataSource(bubble_plot.get_df())

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-97-8659183dfef3> in <module>()
----> 1 renderer_source = ColumnDataSource(bubble_plot.get_df())

NameError: name 'bubble_plot' is not defined

なぜbubble_plotundefined で、どうすればそれを変更できますか? 彼らの例とまったく同じです。この時点まで問題はありません。ありがとうございました!

4

1 に答える 1