# plot

Plot data series

Using a `fints` object for the `tsobj` argument of `plot` is not recommended. Use a `timetable` or `table` instead for financial time series. For more information, see Convert Financial Time Series Objects fints to Timetables.

## Syntax

``plot(tsobj)``
``plot(tsobj,linefmt)``
``plot(___,volumename,bar)``
``hp = plot(___)``

## Description

example

````plot(tsobj)` plots the data series contained in the object `tsobj`. Each data series is a line. `plot` automatically generates a legend and dates on the x-axis. Grid is turned on by default. `plot` uses the default color order as if plotting a matrix. The `plot` command automatically creates subplots when multiple time series are encountered, and they differ greatly on their decimal scales. For example, subplots are generated if one time series data set is in the 10s and another is in the 10,000s.```

example

````plot(tsobj,linefmt)` plots the data series in `tsobj` using the line format specified. For a list of possible line formats, see `plot`. The plot legend is not generated, but the dates on the x-axis and the plot grid are. The specified line format is applied to all data series; that is, all data series have the same line type.```

example

````plot(___,volumename,bar)` specifies which data series is the volume. The volume is plotted in a subplot below the other data series. If `bar = 1`, the volume is plotted as a bar chart. Otherwise, a line plot is used.```

example

````hp = plot(___)` also returns the handle(s) to the object(s) inside the plot figure. If there are multiple lines in the plot, `hp` is a vector of multiple handles.```

## Examples

collapse all

1. Create a `fints` object.

` f = fints((today:today+1)', [4 -2 1; 9 5 7])`
```Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. > In fints (line 169) f = desc: (none) freq: Unknown (0) {'dates: (2)'} {'series1: (2)'} {'series2: (2)'} {'series3: (2)'} {'10-Sep-2021'} {[ 4]} {[ -2]} {[ 1]} {'11-Sep-2021'} {[ 9]} {[ 5]} {[ 7]}```
2. Plot data series for the financial time series object using `plot`.

`plot(f)`
```Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see Convert Financial Time Series Objects (fints) to Timetables. > In fints/plot (line 67) ```

## Input Arguments

collapse all

Financial time series object, specified as a `fints` object.

Data Types: `object`

Line format, specified as a character vector. For a list of possible line formats, see `plot`. The plot legend is not generated, but the dates on the x-axis and the plot grid are. The specified line format is applied to all data series; that is, all data series have the same line type.

Data Types: `char`

Defines which data series is the volume series, specified as a character vector. `volumename` must be the exact data series name for the volume column (case sensitive).

Data Types: `char`

Chart type, specified as an integer, where:

• `0` — (Default) Plot volume as a line.

• `1` — Plot volume as a bar chart. The width of each bar is the same as the default in ```bar, barh```.

Data Types: `double`

## Output Arguments

collapse all

Handle to plot, returned as a handle object. If `bar = 1`, the handle to the patch for the bars is also returned.

Note

To turn off the legend, enter `legend off` at the MATLAB® command line. Once you turn it off, the legend is deleted. To turn it back on, recreate it using the `legend` command as if you are creating it for the first time. To turn off the grid, enter `grid off`. To turn it back on, enter `grid on`.

## Version History

Introduced before R2006a