Skip to content

switchtracetype

Change the plot type of an existing graph.

switchtracetype(obj, type)

Changes the rendering style of graph obj to the new type (a string like 'plot', 'bar', 'scatter', 'stem', etc.) without re-creating the data. Preserves the underlying data and most properties; only the rendering changes.

MathJet-specific. Equivalent to right-clicking a graph in the chart and picking a new graph type from the context menu.

switchtracetype(graph, 'bar')
  • graph — Get a graph handle by name or index.
  • plot — 2D line / marker plot.