![]() It then defines the X and Y axes of the scatter plot to be the age and order total from the filtered dataframe. When the sliders or the select widget are changed, update_data takes the input dataframe df and uses the widget selections to filter the dataframe to only use records with the correct order year and t-shirt category. otting provides functions to create figures and glyphs for a plot/. When the title text is changed, update_title() updates to the new value. bokeh.io is used to establish where the output plot is intended to be displayed. contains ( category_value ) = True ] # Generate the new plot x = selected y = selected source. value selected = df if ( category_value != "All" ): selected = selected. value def update_data ( attrname, old, new ): category_value = category. #Set up update functions and callbacks def update_title ( attrname, old, new ): plot. ![]() The preview should now show the current (non-interactive) scatter plot. For now, we’ll include an empty widgetbox that we’ll populate in a moment when we add the interactivity. The last two lines define the layout of the webapp and adds it to the current “document”. add_root ( row ( inputs, plot, width = 800 ))Ĭreates a plot object with the desired height and width properties ĭefines the title of the plot using the X- and Y-Axis column names Ĭonfigures a set of built-in Bokeh plot tools Ĭomputes the minimum and maximum values of customer age and total, and uses those to define the axis limits Īnd defines the visualization as a scatter plot that plots data from the source defined above. scatter ( 'x', 'y', source = source ) # Set up layouts and add to document inputs = widgetbox () curdoc (). # Set up plot plot = figure ( plot_height = 400, plot_width = 400, title = y_column + " by " + x_column, tools = "crosshair,pan,reset,save,wheel_zoom", x_range =, y_range = ) plot. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |