class_docstr: Create a bar plot.
  
  Preprocessing: this component does *not* accept input.
  Postprocessing: expects a pandas dataframe with the data to plot.
  
  Demos: bar_plot, chicago-bikeshare-dashboard
docstr: Helper for creating the bar plot.
docstr_tok: ["Helper","for","creating","the","bar","plot","."]
code: def create_plot(
      value: pd.DataFrame,
      x: str,
      y: str,
      color: str | None = None,
      vertical: bool = True,
      group: str | None = None,
      title: str | None = None,
      tooltip: list[str] | str | None = None,
      x_title: str | None = None,
      y_title: str | None = None,
      x_label_angle: float | None = None,
      y_label_angle: float | None = None,
      color_legend_title: str | None = None,
      group_title: str | None = None,
      color_legend_position: Literal[
          "left",
          "right",
          "top",
          "bottom",
          "top-left",
          "top-right",
          "bottom-left",
          "bottom-right",
          "none",
      ]
      | None = None,
      height: int | None = None,
      width: int | None = None,
      y_lim: list[int] | None = None,
      interactive: bool | None = True,
      sort: Literal["x", "y", "-x", "-y"] | None = None,
  ):
      """Helper for creating the bar plot."""
      interactive = True if interactive is None else interactive
      orientation = (
          {
              "field": group,
              "title": group_title
              if group_title is not None
              else group,
          }
          if group
          else {}
      )
  
      x_title = x_title or x
      y_title = y_title or y
  
      # If horizontal, switch x and y
      if not vertical:
          y, x = x, y
          x = f"sum({x}):Q"
          y_title, x_title = x_title, y_title
          orientation = {"row": alt.Row(**orientation)} if orientation else {}  # type: ignore
          x_lim = y_lim
          y_lim = None
      else:
          y = f"sum({y}):Q"
          x_lim = None
          orientation = {"column": alt.Column(**orientation)} if orientation else {}  # type: ignore
  
      encodings = dict(
          x=alt.X(
              x,  # type: ignore
              title=x_title,  # type: ignore
              scale=AltairPlot.create_scale(x_lim),  # type: ignore
              axis=alt.Axis(labelAngle=x_label_angle)
              if x_label_angle is not None
              else alt.Axis(),
              sort=sort if vertical and sort is not None else None,
          ),
          y=alt.Y(
              y,  # type: ignore
              title=y_title,  # type: ignore
              scale=AltairPlot.create_scale(y_lim),  # type: ignore
              axis=alt.Axis(labelAngle=y_label_angle)
              if y_label_angle is not None
              else alt.Axis(),
              sort=sort if not vertical and sort is not None else None,
          ),
          **orientation,
      )
      properties = {}
      if title:
          properties["title"] = title
      if height:
          properties["height"] = height
      if width:
          properties["width"] = width
  
      if color:
          domain = value[color].unique().tolist()
          range_ = list(range(len(domain)))
          encodings["color"] = {
              "field": color,
              "type": "nominal",
              "scale": {"domain": domain, "range": range_},
              "legend": AltairPlot.create_legend(
                  position=color_legend_position,
                  title=color_legend_title or color,
              ),
          }
  
      if tooltip:
          encodings["tooltip"] = tooltip
  
      chart = (
          alt.Chart(value)  # type: ignore
          .mark_bar()  # type: ignore
          .encode(**encodings)
          .properties(background="transparent", **properties)
      )
      if interactive:
          chart = chart.interactive()
  
      return chart
  
file_path: gradio/gradio/components/bar_plot.py
imports: from __future__ import annotations
  from typing import Any, Callable, Literal
  import altair
  import pandas
  from gradio_client.documentation import document, set_documentation_group
  from gradio.components.plot import AltairPlot, AltairPlotData, Plot
label_desc: Use image node_id 3 for calling the BarPlot obj's underlying member method code with example usage: obj.create_plot(value, x, y, color, vertical, group, title, tooltip, x_title, y_title, x_label_angle, y_label_angle, color_legend_title, group_title, color_legend_position, height, width, y_lim, interactive, sort) and returns: chart