FunctionLine - Line chart appearance and behavior - MATLAB (original) (raw)

FunctionLine Properties

Line chart appearance and behavior

FunctionLine properties control the appearance and behavior of a FunctionLine object. By changing property values, you can modify certain aspects of the line chart. You can use dot notation to refer to a particular object and property:

fp = fplot(@(x) sin(x)) fp.LineStyle = ':'

expand all

Series index, specified as a positive whole number or "none". This property is useful for reassigning the colors, line styles, or markers ofFunctionLine objects so that they match other objects.

By default, the SeriesIndex property is a number that corresponds to the order in which the FunctionLine object was created, starting at1. MATLAB uses the number to calculate indices for automatically assigning color, line style, or markers when you call plotting functions. The indices refer to the rows of the arrays stored in the ColorOrder andLineStyleOrder properties of the axes. Any objects in the axes that have the same SeriesIndex number also have the same color (and line style and markers, if applicable).

A SeriesIndex value of "none" corresponds to a solid line with a neutral color that does not participate in the indexing scheme.

How Manually Setting Colors, Line Styles, or Markers Overrides SeriesIndex Behavior

To manually control the color, line style, and markers, set theColor, LineStyle, andMarker properties of the FunctionLine object.

When you manually set these properties of an object, MATLAB disables automatic color, line style, and marker selection for that object and allows your selection to persist, regardless of the value of theSeriesIndex property. The ColorMode,LineStyleMode, and MarkerMode properties indicate whether the colors, line styles, and markers have been set manually (by you) or automatically. For each of these mode properties, a value of"manual" indicates manual selection, and a value of"auto" indicates automatic selection.

To enable automatic selection again, set the ColorMode,LineStyleMode, MarkerMode, or all three properties to "auto", and set theSeriesIndex property to a positive whole number.

In some cases, MATLAB sets the SeriesIndex property to0, which also disables automatic selection.

Markers

expand all

Marker size, specified as a positive value in points, where 1 point = 1/72 of an inch.

Function

expand all

Function to plot, specified as a function handle, anonymous function, or a symbolic expression or function.

Number of evaluation points, specified as a number. The default is 23. Because FunctionLine uses adaptive evaluation, the actual number of evaluation points is greater.

Display asymptotes at poles, specified as 'on' or 'off', or as numeric or logical 1 (true) or0 (false). A value of 'on' is equivalent to true, and 'off' is equivalent tofalse. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.

The asymptotes display as gray, dashed vertical lines. fplot displays asymptotes only with the fplot(f) syntax or variants, and not with the fplot(xt,yt) syntax.

Plotting interval for x values, specified as a two-element vector of the form [xmin xmax].

Data

expand all

This property is read-only.

x values, specified as a vector.XData, YData, andZData have equal lengths.

This property is read-only.

y values, specified as a vector.XData, YData, andZData have equal lengths.

This property is read-only.

z values, returned as a vector of zeros.XData, YData, andZData have equal lengths.

Legend

expand all

Text for legend label, specified as a custom character vector or string. The default label is autogenerated from the Function property and thetexlabel function. The legend does not appear until you call the legend function.

Data Types: char | string

Interactivity

expand all

Data tip content, specified as a DataTipTemplate object. You can control the content that appears in a data tip by modifying the properties of the underlying DataTipTemplate object. For a list of properties, seeDataTipTemplate Properties.

For an example of modifying data tips, see Create Custom Data Tips.

Note

The DataTipTemplate object is not returned byfindobj or findall, and it is not copied by copyobj.

Callbacks

Callback Execution Control

expand all

This property is read-only.

Parent/Child

expand all

Parent, specified as an Axes, Group, or Transform object.

Identifiers

expand all

This property is read-only.

Type of graphics object, returned as 'functionline'. Use this property to find all objects of a given type within a plotting hierarchy, for example, searching for the type using findobj.

Object identifier, specified as a character vector or string scalar. You can specify a unique Tag value to serve as an identifier for an object. When you need access to the object elsewhere in your code, you can use the findobj function to search for the object based on the Tag value.

Version History

Introduced in R2016a

expand all

Opt out of automatic color and line style selection for FunctionLine objects by setting the SeriesIndex property to "none". When you specify "none", the FunctionLine object has a solid line style and a neutral color with no markers.

To enable automatic selection again, set the SeriesIndex property to a positive whole number.

Set the SeriesIndex property of any FunctionLine object to control how the objects vary in color, line style, and marker symbol. Changing the value of this property is useful when you want to match the colors, line styles, and markers of different objects in the axes.

Setting or getting UIContextMenu property is not recommended. Instead, use the ContextMenu property, which accepts the same type of input and behaves the same way as theUIContextMenu property.

There are no plans to remove the UIContextMenu property, but it is no longer listed when you call the set, get, orproperties functions on the FunctionLine object.