class_docstr: An IPython widget display a Vega chart.
  
  Specifying the spec directly::
  
      widget = VegaWidget({...})
      widget.update(remove='datum.t < 5', insert=[{...}, {...}])
  
  To modify the created plot, additional options can be passed as in::
  
      widget = VegaWidget(spec, opt)
  
  Usage with ``altair``::
  
      widget = VegaWidget(chart.to_dict())
  
  To select between Vega and Vega-Lite use the ``$schema`` property on
  the ``spec`` dictionary.
  
  The chart can be updated by setting the ``spec`` property. In additon
  embedding options, such as the used theme, can be set via the ``opt``
  property::
  
      widget.spec = {...}
      widget.opt = {"theme": "dark"}
  
  For streaming data, setting the whole spec may be slow. For this use case,
  ``VegaWidget`` offers the ``update`` method. It sends the data to the
  client without persisting it on the Python side. In particular resetting
  the ``spec`` and ``opt`` properties will lose any data changes performed
  via ``update``.
class_docstr_tok: ["An","IPython","widget","display","a","Vega","chart",".","Specifying","the","spec","directly",":",":","widget","=","VegaWidget","(","{","...","}",")","widget.update","(","remove='datum.t","<","5","'",",","insert=","[","{","...","}",",","{","...","}","]",")","To","modify","the","created","plot",",","additional","options","can","be","passed","as","in",":",":","widget","=","VegaWidget","(","spec",",","opt",")","Usage","with","``","altair","``",":",":","widget","=","VegaWidget","(","chart.to_dict","(",")",")","To","select","between","Vega","and","Vega-Lite","use","the","``","$","schema","``","property","on","the","``","spec","``","dictionary",".","The","chart","can","be","updated","by","setting","the","``","spec","``","property",".","In","additon","embedding","options",",","such","as","the","used","theme",",","can","be","set","via","the","``","opt","``","property",":",":","widget.spec","=","{","...","}","widget.opt","=","{","``","theme","''",":","``","dark","''","}","For","streaming","data",",","setting","the","whole","spec","may","be","slow",".","For","this","use","case",",","``","VegaWidget","``","offers","the","``","update","``","method",".","It","sends","the","data","to","the","client","without","persisting","it","on","the","Python","side",".","In","particular","resetting","the","``","spec","``","and","``","opt","``","properties","will","lose","any","data","changes","performed","via","``","update","``","."]
docstr: Update the chart data with a 2d array and their column names.
  
  Updates are only reflected on the client, i.e., after re-displaying
  the widget will show the chart specified in its spec property.
  
  :param str key:
      the name of the dataset to update, as declared in the data
      section of the spec.
  
  :param np.ndarray arr:
      new items to add to the chart data as a 2d numpy array.
  
  :param List[str] columns:
      list of column names for each column of the array.
  
  :param Optional[str] remove:
      a JavaScript expression of items to remove. The item to test can
      be accessed as ``datum``. For example, the call
      ``update(remove="datum.t < 5")`` removes all items with the
      property ``t < 5``.
  
  :param Optional[Bool] resize:
      trigger a resize of the widget after updating.
  
  NB: the array will be wrapped as a one column Table.
  The unique column (fancy_col below) is built as a comma separated
  coords string (i.e. columns param.)
  This naming covention is important because JavaScript will split
  this string to obtain the three names for the x, y, z coords.
docstr_tok: ["Update","the","chart","data","with","a","2d","array","and","their","column","names",".","Updates","are","only","reflected","on","the","client",",","i.e.",",","after","re-displaying","the","widget","will","show","the","chart","specified","in","its","spec","property",".",":","param","str","key",":","the","name","of","the","dataset","to","update",",","as","declared","in","the","data","section","of","the","spec",".",":","param","np.ndarray","arr",":","new","items","to","add","to","the","chart","data","as","a","2d","numpy","array",".",":","param","List","[","str","]","columns",":","list","of","column","names","for","each","column","of","the","array",".",":","param","Optional","[","str","]","remove",":","a","JavaScript","expression","of","items","to","remove",".","The","item","to","test","can","be","accessed","as","``","datum","``",".","For","example",",","the","call","``","update","(","remove=","''","datum.t","<","5","''",")","``","removes","all","items","with","the","property","``","t","<","5","``",".",":","param","Optional","[","Bool","]","resize",":","trigger","a","resize","of","the","widget","after","updating",".","NB",":","the","array","will","be","wrapped","as","a","one","column","Table",".","The","unique","column","(","fancy_col","below",")","is","built","as","a","comma","separated","coords","string","(","i.e",".","columns","param",".",")","This","naming","covention","is","important","because","JavaScript","will","split","this","string","to","obtain","the","three","names","for","the","x",",","y",",","z","coords","."]
code: def update_array2d(self, key, arr, columns, remove=None, resize=True):
      """Update the chart data with a 2d array and their column names.
  
      Updates are only reflected on the client, i.e., after re-displaying
      the widget will show the chart specified in its spec property.
  
      :param str key:
          the name of the dataset to update, as declared in the data
          section of the spec.
  
      :param np.ndarray arr:
          new items to add to the chart data as a 2d numpy array.
  
      :param List[str] columns:
          list of column names for each column of the array.
  
      :param Optional[str] remove:
          a JavaScript expression of items to remove. The item to test can
          be accessed as ``datum``. For example, the call
          ``update(remove="datum.t < 5")`` removes all items with the
          property ``t < 5``.
  
      :param Optional[Bool] resize:
          trigger a resize of the widget after updating.
  
      NB: the array will be wrapped as a one column Table.
      The unique column (fancy_col below) is built as a comma separated
      coords string (i.e. columns param.)
      This naming covention is important because JavaScript will split
      this string to obtain the three names for the x, y, z coords.
      """
      if isinstance(arr, np.ndarray):
          fancy_col = ",".join(columns)
          self._df = NumpyAdapter({fancy_col: arr}, touch_mode=True)
      else:
          assert isinstance(arr, SourceAdapter)
          self._df = arr
      self._df.touch()
      update = dict(key=key)
      if remove is not None:
          update["remove"] = remove
      update["insert"] = "@array2d"
      self.send(dict(type="update", updates=[update], resize=resize))
  
file_path: ipyvega/vega/widget.py
imports: from __future__ import print_function
  import json
  import pandas
  from ._frontend import module_name, EXTENSION_SPEC_VERSION
  from ipytablewidgets import serialization, SourceAdapter, PandasAdapter, NumpyAdapter, TableType
  import numpy
label_desc: Use image node_id 10 for calling the VegaWidget obj's underlying member method code with example usage: obj.update_array2d(key, arr, columns, remove, resize) without return types