code: def create_figure():
      xs = df[x.value].values
      ys = df[y.value].values
      x_title = x.value.title()
      y_title = y.value.title()
  
      kw = dict()
      if x.value in discrete:
          kw["x_range"] = sorted(set(xs))
      if y.value in discrete:
          kw["y_range"] = sorted(set(ys))
      kw["title"] = f"{x_title} vs {y_title}"
  
      p = figure(
          height=600, width=800, tools="pan,box_zoom,hover,reset", **kw
      )
      p.xaxis.axis_label = x_title
      p.yaxis.axis_label = y_title
  
      if x.value in discrete:
          p.xaxis.major_label_orientation = pd.np.pi / 4
  
      sz = 9
      if size.value != "None":
          if len(set(df[size.value])) > N_SIZES:
              groups = pd.qcut(
                  df[size.value].values, N_SIZES, duplicates="drop"
              )
          else:
              groups = pd.Categorical(df[size.value])
          sz = [SIZES[xx] for xx in groups.codes]
  
      c = "#31AADE"
      if color.value != "None":
          if len(set(df[color.value])) > N_COLORS:
              groups = pd.qcut(
                  df[color.value].values, N_COLORS, duplicates="drop"
              )
          else:
              groups = pd.Categorical(df[color.value])
          c = [COLORS[xx] for xx in groups.codes]
  
      p.scatter(
          x=xs,
          y=ys,
          color=c,
          size=sz,
          line_color="white",
          alpha=0.6,
          hover_color="white",
          hover_alpha=0.5,
      )
  
      return p
  
file_path: bokeh/examples/server/app/crossfilter/main.py
imports: import pandas
  from bokeh.layouts import column, row
  from bokeh.models import Select
  from bokeh.palettes import Spectral5
  from bokeh.plotting import curdoc, figure
  from bokeh.sampledata.autompg import autompg_clean
label_desc: Use image node_id 1 for calling a global function with example usage: create_figure() and returns: p