def create(cls): gbounds = cls.gbounds xmin, xmax, ymin, ymax = gbounds app = cls() data = ARDataSource( data_url="/bokeh/taxidata/pickup/", data=dict( x=[0], y=[0], dw=[xmax-xmin], dh=[ymax-ymin], palette=["Greys-256"] ) ) app.pickup_ar_plot_source = data plot = image(source=data, image="image", x="x", y="y", dw="dw", dh="dh", plot_width=400, plot_height=400, palette='palette', x_range=[xmin, xmax], y_range=[ymin, ymax], tools="pan,wheel_zoom,box_zoom,select,reset", title='pickup' ) plot.title_text_font='12pt' app.pickup_plot = plot app.pickup_raw_plot_source = plot.select({'type' : ColumnDataSource})[0] data = ARDataSource( data_url="/bokeh/taxidatavsregular/pickup/", data=dict( x=[0], y=[0], dw=[xmax-xmin], dh=[ymax-ymin], palette=["Greys-256"] ) ) app.pickup_comparison_ar_plot_source = data plot = image(source=data, image="image", x="x", y="y", dw="dw", dh="dh", plot_width=400, plot_height=400, palette='palette', x_range=[xmin, xmax], y_range=[ymin, ymax], tools="pan,wheel_zoom,box_zoom,select,reset", title='pickup comparison plot' ) plot.title_text_font='12pt' app.pickup_comparison_plot = plot app.pickup_comparison_raw_plot_source = plot.select({'type' : ColumnDataSource})[0] data = ARDataSource( data_url="/bokeh/taxidatavsregular/dropoff/", data=dict( x=[0], y=[0], dw=[xmax-xmin], dh=[ymax-ymin], palette=["Greys-256"] ) ) app.dropoff_comparison_ar_plot_source = data plot = image(source=data, image="image", x="x", y="y", dw="dw", dh="dh", plot_width=400, plot_height=400, palette='palette', x_range=[xmin, xmax], y_range=[ymin, ymax], tools="pan,wheel_zoom,box_zoom,select,reset", title='dropoff comparison plot' ) plot.title_text_font='12pt' app.dropoff_comparison_plot = plot app.dropoff_comparison_raw_plot_source = plot.select({'type' : ColumnDataSource})[0] data = ARDataSource( data_url="/bokeh/taxidata/dropoff/", data=dict( x=[0], y=[0], dw=[xmax-xmin], dh=[ymax-ymin], palette=["Greys-256"] ) ) app.dropoff_ar_plot_source = data plot = image(source=data, image="image", plot_width=400, plot_height=400, x="x", y="y", dw="dw", dh="dh", palette='palette', x_range=[xmin, xmax], y_range=[ymin, ymax], tools="pan,wheel_zoom,box_zoom,reset,select,reset", title='dropoff' ) plot.title_text_font='12pt' app.dropoff_plot = plot app.dropoff_raw_plot_source = plot.select({'type' : ColumnDataSource})[0] app.make_trip_distance_histogram() app.make_trip_time_histogram() app.widgets = VBoxForm() app.day_of_week_selector = Select.create( options=["-----", 'Weekday', 'Friday/Saturday/Sunday', 'Saturday/Sunday'], name='Day Of Week' ) app.date_slider = DateRangeSlider(value=(dt.datetime(2012, 1, 1), dt.datetime(2013, 1, 28)), bounds=(dt.datetime(2012, 12, 31), dt.datetime(2013, 1, 31)), step={'days' : 1}, range=({'days' : 1},{'days':30}), name='period', title='period' ) app.hour_selector = Select.create(options=["-----", '8am-12pm', '12pm-4pm', '4pm-8pm', '8pm-12am', '12am-4am'], name='Hour of the Day' ) title = Paragraph(text="NYC Taxi Cab Data", width=250, height=50) app.widgets.children=[title, app.date_slider, Paragraph(width=250, height=10), app.hour_selector, app.day_of_week_selector, Paragraph(width=250, height=10), app.distance_histogram, Paragraph(text="", width=250, height=50), app.time_histogram] app.images = VBox() app.regular = HBox() app.filtered = HBox() app.regular.children = [app.pickup_plot, app.dropoff_plot] app.filtered.children = [app.pickup_comparison_plot, app.dropoff_comparison_plot] app.images.children = [app.regular] app.children = [app.widgets, app.images] return app