# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

## Changing Line Properties

This example shows how to get properties of a line in MATLAB® and change line property values to customize your plot.

### Line Objects

There are several ways to create a line object in MATLAB. One way is to use the `plot` command. You can get the line object created by the `plot` command by using an output argument. The display of the line object, `p`, shows the most commonly used line properties, such as `Color`, `LineStyle`, and `Marker`.

```x = 0:0.2:10; y = besselj(0, x); figure p = plot(x,y)```
```p = Line with properties: Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [1x51 double] YData: [1x51 double] ZData: [1x0 double] Show all properties ```

### Get Individual Line Properties

To access individual properties, use dot notation syntax `object.PropertyName`. For example, the following command returns the `LineWidth` property of the line.

`p.LineWidth`
```ans = 0.5000 ```

### Change Line Properties

To customize the look of your plot, change line properties using dot notation.

```p.Color = [1 0 0]; % set line color to red p.LineStyle = '--'; % set line to be dashed p.Marker = 'square'; % use square markers p.MarkerEdgeColor = [0 0 1]; % set marker color to blue```

### Get All Line Properties

Graphics objects in MATLAB have many properties. To see all the properties of a line, use the `get` command.

`get(p)`
``` AlignVertexCenters: 'off' Annotation: [1x1 matlab.graphics.eventdata.Annotation] BeingDeleted: 'off' BusyAction: 'queue' ButtonDownFcn: '' Children: [0x0 GraphicsPlaceholder] Clipping: 'on' Color: [1 0 0] CreateFcn: '' DeleteFcn: '' DisplayName: '' HandleVisibility: 'on' HitTest: 'on' Interruptible: 'on' LineJoin: 'round' LineStyle: '--' LineWidth: 0.5000 Marker: 'square' MarkerEdgeColor: [0 0 1] MarkerFaceColor: 'none' MarkerIndices: [1x51 uint64] MarkerSize: 6 Parent: [1x1 Axes] PickableParts: 'visible' Selected: 'off' SelectionHighlight: 'on' Tag: '' Type: 'line' UIContextMenu: [0x0 GraphicsPlaceholder] UserData: [] Visible: 'on' XData: [1x51 double] XDataMode: 'manual' XDataSource: '' YData: [1x51 double] YDataSource: '' ZData: [1x0 double] ZDataSource: '' ```